summary refs log tree commit diff
path: root/synapse/rest/client
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-18 10:09:14 +0000
committerErik Johnston <erik@matrix.org>2016-01-18 15:17:56 +0000
commitd1f56f732e1c213e203f287945d84966c3eec6f3 (patch)
treebfa3081212b96b57639e5f85cbfb18c5b21b2953 /synapse/rest/client
parentRemove internal ids (diff)
downloadsynapse-d1f56f732e1c213e203f287945d84966c3eec6f3.tar.xz
Use static for const dicts
Diffstat (limited to 'synapse/rest/client')
-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"])