Disable pushing for server ACL events (MSC3786). (#13997)
Switches to the stable identifier for MSC3786 and enables it by default. This disables pushes of m.room.server_acl events.pull/14046/head
parent
27fa0fa698
commit
e70c6b720e
|
@ -0,0 +1 @@
|
||||||
|
Ignore server ACL changes when generating pushes. Implement [MSC3786](https://github.com/matrix-org/matrix-spec-proposals/pull/3786).
|
|
@ -173,7 +173,7 @@ pub const BASE_APPEND_OVERRIDE_RULES: &[PushRule] = &[
|
||||||
default_enabled: true,
|
default_enabled: true,
|
||||||
},
|
},
|
||||||
PushRule {
|
PushRule {
|
||||||
rule_id: Cow::Borrowed("global/override/.org.matrix.msc3786.rule.room.server_acl"),
|
rule_id: Cow::Borrowed("global/override/.m.rule.room.server_acl"),
|
||||||
priority_class: 5,
|
priority_class: 5,
|
||||||
conditions: Cow::Borrowed(&[
|
conditions: Cow::Borrowed(&[
|
||||||
Condition::Known(KnownCondition::EventMatch(EventMatchCondition {
|
Condition::Known(KnownCondition::EventMatch(EventMatchCondition {
|
||||||
|
|
|
@ -401,7 +401,6 @@ impl PushRules {
|
||||||
pub struct FilteredPushRules {
|
pub struct FilteredPushRules {
|
||||||
push_rules: PushRules,
|
push_rules: PushRules,
|
||||||
enabled_map: BTreeMap<String, bool>,
|
enabled_map: BTreeMap<String, bool>,
|
||||||
msc3786_enabled: bool,
|
|
||||||
msc3772_enabled: bool,
|
msc3772_enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,13 +410,11 @@ impl FilteredPushRules {
|
||||||
pub fn py_new(
|
pub fn py_new(
|
||||||
push_rules: PushRules,
|
push_rules: PushRules,
|
||||||
enabled_map: BTreeMap<String, bool>,
|
enabled_map: BTreeMap<String, bool>,
|
||||||
msc3786_enabled: bool,
|
|
||||||
msc3772_enabled: bool,
|
msc3772_enabled: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
push_rules,
|
push_rules,
|
||||||
enabled_map,
|
enabled_map,
|
||||||
msc3786_enabled,
|
|
||||||
msc3772_enabled,
|
msc3772_enabled,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,12 +434,6 @@ impl FilteredPushRules {
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|rule| {
|
.filter(|rule| {
|
||||||
// Ignore disabled experimental push rules
|
// Ignore disabled experimental push rules
|
||||||
if !self.msc3786_enabled
|
|
||||||
&& rule.rule_id == "global/override/.org.matrix.msc3786.rule.room.server_acl"
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if !self.msc3772_enabled
|
if !self.msc3772_enabled
|
||||||
&& rule.rule_id == "global/underride/.org.matrix.msc3772.thread_reply"
|
&& rule.rule_id == "global/underride/.org.matrix.msc3772.thread_reply"
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,11 +26,7 @@ class PushRules:
|
||||||
|
|
||||||
class FilteredPushRules:
|
class FilteredPushRules:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self, push_rules: PushRules, enabled_map: Dict[str, bool], msc3772_enabled: bool
|
||||||
push_rules: PushRules,
|
|
||||||
enabled_map: Dict[str, bool],
|
|
||||||
msc3786_enabled: bool,
|
|
||||||
msc3772_enabled: bool,
|
|
||||||
): ...
|
): ...
|
||||||
def rules(self) -> Collection[Tuple[PushRule, bool]]: ...
|
def rules(self) -> Collection[Tuple[PushRule, bool]]: ...
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,6 @@ class ExperimentalConfig(Config):
|
||||||
# MSC2815 (allow room moderators to view redacted event content)
|
# MSC2815 (allow room moderators to view redacted event content)
|
||||||
self.msc2815_enabled: bool = experimental.get("msc2815_enabled", False)
|
self.msc2815_enabled: bool = experimental.get("msc2815_enabled", False)
|
||||||
|
|
||||||
# MSC3786 (Add a default push rule to ignore m.room.server_acl events)
|
|
||||||
self.msc3786_enabled: bool = experimental.get("msc3786_enabled", False)
|
|
||||||
|
|
||||||
# MSC3771: Thread read receipts
|
# MSC3771: Thread read receipts
|
||||||
self.msc3771_enabled: bool = experimental.get("msc3771_enabled", False)
|
self.msc3771_enabled: bool = experimental.get("msc3771_enabled", False)
|
||||||
# MSC3772: A push rule for mutual relations.
|
# MSC3772: A push rule for mutual relations.
|
||||||
|
|
|
@ -81,15 +81,10 @@ def _load_rules(
|
||||||
for rawrule in rawrules
|
for rawrule in rawrules
|
||||||
]
|
]
|
||||||
|
|
||||||
push_rules = PushRules(
|
push_rules = PushRules(ruleslist)
|
||||||
ruleslist,
|
|
||||||
)
|
|
||||||
|
|
||||||
filtered_rules = FilteredPushRules(
|
filtered_rules = FilteredPushRules(
|
||||||
push_rules,
|
push_rules, enabled_map, msc3772_enabled=experimental_config.msc3772_enabled
|
||||||
enabled_map,
|
|
||||||
msc3786_enabled=experimental_config.msc3786_enabled,
|
|
||||||
msc3772_enabled=experimental_config.msc3772_enabled,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return filtered_rules
|
return filtered_rules
|
||||||
|
|
Loading…
Reference in New Issue