Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Use the stable prefix for MSC3786. #13997

Merged
merged 4 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/13997.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ignore server ACL changes when generating pushes. Implement [MSC3786](https://github.com/matrix-org/matrix-spec-proposals/pull/3786).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps reword this to make it clear this is making an experimental feature stable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was disabled by default, so I think we can kind of just say that it is now going to be enabled?

2 changes: 1 addition & 1 deletion rust/src/push/base_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub const BASE_APPEND_OVERRIDE_RULES: &[PushRule] = &[
default_enabled: true,
},
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,
conditions: Cow::Borrowed(&[
Condition::Known(KnownCondition::EventMatch(EventMatchCondition {
Expand Down
9 changes: 0 additions & 9 deletions rust/src/push/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ impl PushRules {
pub struct FilteredPushRules {
push_rules: PushRules,
enabled_map: BTreeMap<String, bool>,
msc3786_enabled: bool,
msc3772_enabled: bool,
}

Expand All @@ -411,13 +410,11 @@ impl FilteredPushRules {
pub fn py_new(
push_rules: PushRules,
enabled_map: BTreeMap<String, bool>,
msc3786_enabled: bool,
msc3772_enabled: bool,
) -> Self {
Self {
push_rules,
enabled_map,
msc3786_enabled,
msc3772_enabled,
}
}
Expand All @@ -437,12 +434,6 @@ impl FilteredPushRules {
.iter()
.filter(|rule| {
// 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
&& rule.rule_id == "global/underride/.org.matrix.msc3772.thread_reply"
{
Expand Down
6 changes: 1 addition & 5 deletions stubs/synapse/synapse_rust/push.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ class PushRules:

class FilteredPushRules:
def __init__(
self,
push_rules: PushRules,
enabled_map: Dict[str, bool],
msc3786_enabled: bool,
msc3772_enabled: bool,
self, push_rules: PushRules, enabled_map: Dict[str, bool], msc3772_enabled: bool
): ...
def rules(self) -> Collection[Tuple[PushRule, bool]]: ...

Expand Down
3 changes: 0 additions & 3 deletions synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
# MSC2815 (allow room moderators to view redacted event content)
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
self.msc3771_enabled: bool = experimental.get("msc3771_enabled", False)
# MSC3772: A push rule for mutual relations.
Expand Down
9 changes: 2 additions & 7 deletions synapse/storage/databases/main/push_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,10 @@ def _load_rules(
for rawrule in rawrules
]

push_rules = PushRules(
ruleslist,
)
push_rules = PushRules(ruleslist)

filtered_rules = FilteredPushRules(
push_rules,
enabled_map,
msc3786_enabled=experimental_config.msc3786_enabled,
msc3772_enabled=experimental_config.msc3772_enabled,
push_rules, enabled_map, msc3772_enabled=experimental_config.msc3772_enabled
)

return filtered_rules
Expand Down