Stabilize support for MSC3958 (suppress notifications from edits). (#16113)

This commit is contained in:
Patrick Cloke 2023-08-23 13:22:34 -04:00 committed by GitHub
parent 18279631e9
commit 33fa82a34c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 3 additions and 20 deletions

View file

@ -0,0 +1 @@
Suppress notifications from message edits per [MSC3958](https://github.com/matrix-org/matrix-spec-proposals/pull/3958).

View file

@ -197,7 +197,6 @@ fn bench_eval_message(b: &mut Bencher) {
false, false,
false, false,
false, false,
false,
); );
b.iter(|| eval.run(&rules, Some("bob"), Some("person"))); b.iter(|| eval.run(&rules, Some("bob"), Some("person")));

View file

@ -228,7 +228,7 @@ pub const BASE_APPEND_OVERRIDE_RULES: &[PushRule] = &[
// We don't want to notify on edits *unless* the edit directly mentions a // We don't want to notify on edits *unless* the edit directly mentions a
// user, which is handled above. // user, which is handled above.
PushRule { PushRule {
rule_id: Cow::Borrowed("global/override/.org.matrix.msc3958.suppress_edits"), rule_id: Cow::Borrowed("global/override/.m.rule.suppress_edits"),
priority_class: 5, priority_class: 5,
conditions: Cow::Borrowed(&[Condition::Known(KnownCondition::EventPropertyIs( conditions: Cow::Borrowed(&[Condition::Known(KnownCondition::EventPropertyIs(
EventPropertyIsCondition { EventPropertyIsCondition {

View file

@ -564,7 +564,7 @@ fn test_requires_room_version_supports_condition() {
}; };
let rules = PushRules::new(vec![custom_rule]); let rules = PushRules::new(vec![custom_rule]);
result = evaluator.run( result = evaluator.run(
&FilteredPushRules::py_new(rules, BTreeMap::new(), true, false, true, false), &FilteredPushRules::py_new(rules, BTreeMap::new(), true, false, true),
None, None,
None, None,
); );

View file

@ -527,7 +527,6 @@ pub struct FilteredPushRules {
msc1767_enabled: bool, msc1767_enabled: bool,
msc3381_polls_enabled: bool, msc3381_polls_enabled: bool,
msc3664_enabled: bool, msc3664_enabled: bool,
msc3958_suppress_edits_enabled: bool,
} }
#[pymethods] #[pymethods]
@ -539,7 +538,6 @@ impl FilteredPushRules {
msc1767_enabled: bool, msc1767_enabled: bool,
msc3381_polls_enabled: bool, msc3381_polls_enabled: bool,
msc3664_enabled: bool, msc3664_enabled: bool,
msc3958_suppress_edits_enabled: bool,
) -> Self { ) -> Self {
Self { Self {
push_rules, push_rules,
@ -547,7 +545,6 @@ impl FilteredPushRules {
msc1767_enabled, msc1767_enabled,
msc3381_polls_enabled, msc3381_polls_enabled,
msc3664_enabled, msc3664_enabled,
msc3958_suppress_edits_enabled,
} }
} }
@ -584,12 +581,6 @@ impl FilteredPushRules {
return false; return false;
} }
if !self.msc3958_suppress_edits_enabled
&& rule.rule_id == "global/override/.org.matrix.msc3958.suppress_edits"
{
return false;
}
true true
}) })
.map(|r| { .map(|r| {

View file

@ -46,7 +46,6 @@ class FilteredPushRules:
msc1767_enabled: bool, msc1767_enabled: bool,
msc3381_polls_enabled: bool, msc3381_polls_enabled: bool,
msc3664_enabled: bool, msc3664_enabled: bool,
msc3958_suppress_edits_enabled: bool,
): ... ): ...
def rules(self) -> Collection[Tuple[PushRule, bool]]: ... def rules(self) -> Collection[Tuple[PushRule, bool]]: ...

View file

@ -383,11 +383,6 @@ class ExperimentalConfig(Config):
# MSC3391: Removing account data. # MSC3391: Removing account data.
self.msc3391_enabled = experimental.get("msc3391_enabled", False) self.msc3391_enabled = experimental.get("msc3391_enabled", False)
# MSC3959: Do not generate notifications for edits.
self.msc3958_supress_edit_notifs = experimental.get(
"msc3958_supress_edit_notifs", False
)
# MSC3967: Do not require UIA when first uploading cross signing keys # MSC3967: Do not require UIA when first uploading cross signing keys
self.msc3967_enabled = experimental.get("msc3967_enabled", False) self.msc3967_enabled = experimental.get("msc3967_enabled", False)

View file

@ -88,7 +88,6 @@ def _load_rules(
msc1767_enabled=experimental_config.msc1767_enabled, msc1767_enabled=experimental_config.msc1767_enabled,
msc3664_enabled=experimental_config.msc3664_enabled, msc3664_enabled=experimental_config.msc3664_enabled,
msc3381_polls_enabled=experimental_config.msc3381_polls_enabled, msc3381_polls_enabled=experimental_config.msc3381_polls_enabled,
msc3958_suppress_edits_enabled=experimental_config.msc3958_supress_edit_notifs,
) )
return filtered_rules return filtered_rules

View file

@ -382,7 +382,6 @@ class TestBulkPushRuleEvaluator(HomeserverTestCase):
) )
) )
@override_config({"experimental_features": {"msc3958_supress_edit_notifs": True}})
def test_suppress_edits(self) -> None: def test_suppress_edits(self) -> None:
"""Under the default push rules, event edits should not generate notifications.""" """Under the default push rules, event edits should not generate notifications."""
bulk_evaluator = BulkPushRuleEvaluator(self.hs) bulk_evaluator = BulkPushRuleEvaluator(self.hs)