summary refs log tree commit diff
path: root/rust/src/push/base_rules.rs
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-02-03 14:31:14 -0500
committerGitHub <noreply@github.com>2023-02-03 14:31:14 -0500
commitb2d97bac0910c4730ea83fbee50abbdce2ba23be (patch)
treef103ee58de839f2c319f2ba3ee6e1e887db0af98 /rust/src/push/base_rules.rs
parentProperly typecheck tests.app (#14984 (diff)
downloadsynapse-b2d97bac0910c4730ea83fbee50abbdce2ba23be.tar.xz
Implement MSC3958: suppress notifications from edits (#14960)
Co-authored-by: Brad Murray <brad@beeper.com>
Co-authored-by: Nick Barrett <nick@beeper.com>

Copy the suppress_edits push rule from Beeper to implement MSC3958.

https://github.com/beeper/synapse/blame/9415a1284b1bfb558bd66f28c24ca1611e6c6fa2/rust/src/push/base_rules.rs#L98-L114
Diffstat (limited to 'rust/src/push/base_rules.rs')
-rw-r--r--rust/src/push/base_rules.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/rust/src/push/base_rules.rs b/rust/src/push/base_rules.rs
index 49add4e951..e9af26dd4f 100644
--- a/rust/src/push/base_rules.rs
+++ b/rust/src/push/base_rules.rs
@@ -63,6 +63,23 @@ pub const BASE_PREPEND_OVERRIDE_RULES: &[PushRule] = &[PushRule {
 }];
 
 pub const BASE_APPEND_OVERRIDE_RULES: &[PushRule] = &[
+    // We don't want to notify on edits. Not only can this be confusing in real
+    // time (2 notifications, one message) but it's especially confusing
+    // if a bridge needs to edit a previously backfilled message.
+    PushRule {
+        rule_id: Cow::Borrowed("global/override/.com.beeper.suppress_edits"),
+        priority_class: 5,
+        conditions: Cow::Borrowed(&[Condition::Known(KnownCondition::EventMatch(
+            EventMatchCondition {
+                key: Cow::Borrowed("content.m.relates_to.rel_type"),
+                pattern: Some(Cow::Borrowed("m.replace")),
+                pattern_type: None,
+            },
+        ))]),
+        actions: Cow::Borrowed(&[Action::DontNotify]),
+        default: true,
+        default_enabled: true,
+    },
     PushRule {
         rule_id: Cow::Borrowed("global/override/.m.rule.suppress_notices"),
         priority_class: 5,