summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2016-01-22 17:06:52 +0000
committerDavid Baker <dbkr@users.noreply.github.com>2016-01-22 17:06:52 +0000
commit0e0e441b33a12474acf10d312b56b019f2df89a7 (patch)
treeaa009cc7ad9c6e31326fdd2b864972b11a86d64f
parentDon't mutate cached values (diff)
parentDon't add notifications to the table unless there's actually a 'notify' action (diff)
downloadsynapse-0e0e441b33a12474acf10d312b56b019f2df89a7.tar.xz
Merge pull request #522 from matrix-org/dbkr/no_push_unless_notify
Don't add notifications to the table unless there's actually a 'notify' action
-rw-r--r--synapse/push/bulk_push_rule_evaluator.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/push/bulk_push_rule_evaluator.py b/synapse/push/bulk_push_rule_evaluator.py
index ec917c2398..c211c58923 100644
--- a/synapse/push/bulk_push_rule_evaluator.py
+++ b/synapse/push/bulk_push_rule_evaluator.py
@@ -139,8 +139,16 @@ class BulkPushRuleEvaluator:
                     evaluator, rule['conditions'], uid, display_name, condition_cache
                 )
                 if matches:
+                    notify = False
+                    actions = []
+                    for a in rule['actions']:
+                        if a != 'dont_notify':
+                            actions.append(a)
+                        elif a == 'notify':
+                            notify = True
+
                     actions = [x for x in rule['actions'] if x != 'dont_notify']
-                    if actions:
+                    if actions and notify:
                         actions_by_user[uid] = actions
                     break
         defer.returnValue(actions_by_user)