summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-22 16:03:55 +0000
committerErik Johnston <erik@matrix.org>2016-01-22 16:03:55 +0000
commitdb6e26bb8c29556b43ca2e8c52510158a6f71204 (patch)
tree6b326085d3034d98942037be7a551ff84fc93c3d /synapse
parentMerge pull request #520 from matrix-org/dbkr/bulk_push_overlay_enabled (diff)
downloadsynapse-db6e26bb8c29556b43ca2e8c52510158a6f71204.tar.xz
Don't mutate cached values
Diffstat (limited to 'synapse')
-rw-r--r--synapse/push/bulk_push_rule_evaluator.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py
index 06250d2d96..ec917c2398 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)