summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-25 12:49:45 +0000
committerErik Johnston <erik@matrix.org>2016-01-25 12:49:45 +0000
commit42deca50c2c2d15e78e1861088297fe20b88cd32 (patch)
treed79bbc7dee4e491f0a31a275fdf338be9afd0618
parentMove logic from rest/ to handlers/ (diff)
parentMerge branch 'erikj/filters' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-42deca50c2c2d15e78e1861088297fe20b88cd32.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/sync
-rw-r--r--synapse/push/bulk_push_rule_evaluator.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py
index 06250d2d96..20c60422bf 100644
--- a/synapse/push/bulk_push_rule_evaluator.py
+++ b/synapse/push/bulk_push_rule_evaluator.py
@@ -55,11 +55,15 @@ def _get_rules(room_id, user_ids, store):
 
         user_enabled_map = rules_enabled_by_user[uid]
 
-        for rule in rules_by_user[uid]:
+        for i, rule in enumerate(rules_by_user[uid]):
             rule_id = rule['rule_id']
 
             if rule_id in user_enabled_map:
-                rule['enabled'] = user_enabled_map[rule_id]
+                if rule.get('enabled', True) != bool(user_enabled_map[rule_id]):
+                    # Rules are cached across users.
+                    rule = dict(rule)
+                    rule['enabled'] = bool(user_enabled_map[rule_id])
+                    rules_by_user[uid][i] = rule
 
     defer.returnValue(rules_by_user)
 
@@ -136,7 +140,7 @@ class BulkPushRuleEvaluator:
                 )
                 if matches:
                     actions = [x for x in rule['actions'] if x != 'dont_notify']
-                    if actions:
+                    if actions and 'notify' in actions:
                         actions_by_user[uid] = actions
                     break
         defer.returnValue(actions_by_user)