Adopt MSC4505 identifiers for the live location share push rules

The MSC has been published as MSC4505 (Push Rules for Live Location
Sharing): rename the experimental flag to msc4505_enabled and the rule
ids to the unstable identifiers it defines
(.org.matrix.msc4505.rule.beacon_info(_one_to_one)), and add the
.org.matrix.msc4505.rule.beacon override it also defines, explicitly
suppressing beacon update events in unencrypted rooms.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uk8aPxHn3BHCe52L226jdG
This commit is contained in:
Matthew Hodgson
2026-07-14 12:50:08 +01:00
co-authored by Claude Fable 5
parent 849032d6d5
commit 6e37f382b2
5 changed files with 30 additions and 15 deletions
+18 -2
View File
@@ -273,6 +273,22 @@ pub const BASE_APPEND_OVERRIDE_RULES: &[PushRule] = &[
default: true,
default_enabled: true,
},
// MSC4505: explicitly suppress live location share beacon updates in unencrypted
// rooms (in encrypted rooms they arrive as m.room.encrypted and can only be
// suppressed client-side after decryption).
PushRule {
rule_id: Cow::Borrowed("global/override/.org.matrix.msc4505.rule.beacon"),
priority_class: 5,
conditions: Cow::Borrowed(&[Condition::Known(KnownCondition::EventMatch(
EventMatchCondition {
key: Cow::Borrowed("type"),
pattern: Cow::Borrowed("org.matrix.msc3672.beacon"),
},
))]),
actions: Cow::Borrowed(&[]),
default: true,
default_enabled: true,
},
];
pub const BASE_APPEND_CONTENT_RULES: &[PushRule] = &[PushRule {
@@ -722,7 +738,7 @@ pub const BASE_APPEND_UNDERRIDE_RULES: &[PushRule] = &[
default_enabled: true,
},
PushRule {
rule_id: Cow::Borrowed("global/underride/.io.element.rule.beacon_info_one_to_one"),
rule_id: Cow::Borrowed("global/underride/.org.matrix.msc4505.rule.beacon_info_one_to_one"),
priority_class: 1,
conditions: Cow::Borrowed(&[
Condition::Known(KnownCondition::RoomMemberCount {
@@ -742,7 +758,7 @@ pub const BASE_APPEND_UNDERRIDE_RULES: &[PushRule] = &[
default_enabled: true,
},
PushRule {
rule_id: Cow::Borrowed("global/underride/.io.element.rule.beacon_info"),
rule_id: Cow::Borrowed("global/underride/.org.matrix.msc4505.rule.beacon_info"),
priority_class: 1,
conditions: Cow::Borrowed(&[
Condition::Known(KnownCondition::EventMatch(EventMatchCondition {
+5 -5
View File
@@ -559,7 +559,7 @@ pub struct FilteredPushRules {
msc4028_push_encrypted_events: bool,
msc4210_enabled: bool,
msc4306_enabled: bool,
mscxxxx_beacon_push_rules_enabled: bool,
msc4505_enabled: bool,
}
#[pymethods]
@@ -575,7 +575,7 @@ impl FilteredPushRules {
msc4028_push_encrypted_events: bool,
msc4210_enabled: bool,
msc4306_enabled: bool,
mscxxxx_beacon_push_rules_enabled: bool,
msc4505_enabled: bool,
) -> Self {
Self {
push_rules,
@@ -586,7 +586,7 @@ impl FilteredPushRules {
msc4028_push_encrypted_events,
msc4210_enabled,
msc4306_enabled,
mscxxxx_beacon_push_rules_enabled,
msc4505_enabled,
}
}
@@ -623,8 +623,8 @@ impl FilteredPushRules {
return false;
}
if !self.mscxxxx_beacon_push_rules_enabled
&& rule.rule_id.contains("/.io.element.rule.beacon_info")
if !self.msc4505_enabled
&& rule.rule_id.contains("/.org.matrix.msc4505.rule.beacon")
{
return false;
}
+5 -6
View File
@@ -156,12 +156,11 @@ class ExperimentalConfig(Config):
"msc3381_polls_enabled", False
)
# MSCXXXX (unnumbered draft): default push rules for live location share
# beacon_info start events (the MSC3672 state event). Unstable rule ids:
# .io.element.rule.beacon_info(_one_to_one).
self.mscxxxx_beacon_push_rules_enabled: bool = experimental.get(
"mscxxxx_beacon_push_rules_enabled", False
)
# MSC4505: default push rules for live location sharing — notify on
# beacon_info start events (the MSC3672 state event), suppress beacon
# updates. Unstable rule ids: .org.matrix.msc4505.rule.beacon_info
# (_one_to_one) / .org.matrix.msc4505.rule.beacon.
self.msc4505_enabled: bool = experimental.get("msc4505_enabled", False)
# MSC3912: Relation-based redactions.
self.msc3912_enabled: bool = experimental.get("msc3912_enabled", False)
+1 -1
View File
@@ -107,7 +107,7 @@ def _load_rules(
msc4028_push_encrypted_events=experimental_config.msc4028_push_encrypted_events,
msc4210_enabled=experimental_config.msc4210_enabled,
msc4306_enabled=experimental_config.msc4306_enabled,
mscxxxx_beacon_push_rules_enabled=experimental_config.mscxxxx_beacon_push_rules_enabled,
msc4505_enabled=experimental_config.msc4505_enabled,
)
return filtered_rules
+1 -1
View File
@@ -50,7 +50,7 @@ class FilteredPushRules:
msc4028_push_encrypted_events: bool,
msc4210_enabled: bool,
msc4306_enabled: bool,
mscxxxx_beacon_push_rules_enabled: bool,
msc4505_enabled: bool,
): ...
def rules(self) -> Collection[tuple[PushRule, bool]]: ...