summary refs log tree commit diff
path: root/synapse/rest/client/v1/push_rule.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/rest/client/v1/push_rule.py')
-rw-r--r--synapse/rest/client/v1/push_rule.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/push_rule.py b/synapse/rest/client/v1/push_rule.py
index b176efd8a8..aa861e7033 100644
--- a/synapse/rest/client/v1/push_rule.py
+++ b/synapse/rest/client/v1/push_rule.py
@@ -126,7 +126,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
             rule["actions"] = json.loads(rawrule["actions"])
             ruleslist.append(rule)
 
-        ruleslist = baserules.list_with_base_rules(ruleslist, user)
+        ruleslist = baserules.list_with_base_rules(ruleslist)
 
         rules = {'global': {}, 'device': {}}
 
@@ -144,6 +144,12 @@ class PushRuleRestServlet(ClientV1RestServlet):
             for c in r["conditions"]:
                 c.pop("_id", None)
 
+                pattern_type = c.pop("pattern_type", None)
+                if pattern_type == "user_id":
+                    c["pattern"] = user.to_string()
+                elif pattern_type == "user_localpart":
+                    c["pattern"] = user.localpart
+
             if r['priority_class'] > PRIORITY_CLASS_MAP['override']:
                 # per-device rule
                 profile_tag = _profile_tag_from_conditions(r["conditions"])