summary refs log tree commit diff
path: root/synapse/push/clientformat.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-03-02 08:30:51 -0500
committerGitHub <noreply@github.com>2023-03-02 08:30:51 -0500
commit8ef324ea6f1390876940989eacc8734fe0d15582 (patch)
tree1e4ec1365ff9610fd0615b4ba6dccde4fef698e5 /synapse/push/clientformat.py
parentFix conflicting URLs for dehydrated devices. (#15180) (diff)
downloadsynapse-8ef324ea6f1390876940989eacc8734fe0d15582.tar.xz
Update intentional mentions (MSC3952) to depend on `exact_event_property_contains` (MSC3966). (#15051)
This replaces the specific `is_user_mention` push rule condition
used in MSC3952 with the generic `exact_event_property_contains`
push rule condition from MSC3966.
Diffstat (limited to 'synapse/push/clientformat.py')
-rw-r--r--synapse/push/clientformat.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/synapse/push/clientformat.py b/synapse/push/clientformat.py
index bb76c169c6..222afbdcc8 100644
--- a/synapse/push/clientformat.py
+++ b/synapse/push/clientformat.py
@@ -41,11 +41,12 @@ def format_push_rules_for_user(
 
         rulearray.append(template_rule)
 
-        pattern_type = template_rule.pop("pattern_type", None)
-        if pattern_type == "user_id":
-            template_rule["pattern"] = user.to_string()
-        elif pattern_type == "user_localpart":
-            template_rule["pattern"] = user.localpart
+        for type_key in ("pattern", "value"):
+            type_value = template_rule.pop(f"{type_key}_type", None)
+            if type_value == "user_id":
+                template_rule[type_key] = user.to_string()
+            elif type_value == "user_localpart":
+                template_rule[type_key] = user.localpart
 
         template_rule["enabled"] = enabled