summary refs log tree commit diff
path: root/synapse/push
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/push')
-rw-r--r--synapse/push/__init__.py4
-rw-r--r--synapse/push/baserules.py3
2 files changed, 7 insertions, 0 deletions
diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py
index 0fb3e4f7f3..40fae91ab5 100644
--- a/synapse/push/__init__.py
+++ b/synapse/push/__init__.py
@@ -82,6 +82,8 @@ class Pusher(object):
             r['conditions'] = json.loads(r['conditions'])
             r['actions'] = json.loads(r['actions'])
 
+        enabled_map = yield self.store.get_push_rules_enabled_for_user_name(self.user_name)
+
         user = UserID.from_string(self.user_name)
 
         rules = baserules.list_with_base_rules(rawrules, user)
@@ -107,6 +109,8 @@ class Pusher(object):
             room_member_count += 1
 
         for r in rules:
+            if r['rule_id'] in enabled_map and not enabled_map[r['rule_id']]:
+                continue
             matches = True
 
             conditions = r['conditions']
diff --git a/synapse/push/baserules.py b/synapse/push/baserules.py
index 162d265f66..ba9a181b56 100644
--- a/synapse/push/baserules.py
+++ b/synapse/push/baserules.py
@@ -45,6 +45,7 @@ def make_base_rules(user, kind):
 def make_base_content_rules(user):
     return [
         {
+            'rule_id': '.m.rule.contains_user_name',
             'conditions': [
                 {
                     'kind': 'event_match',
@@ -66,6 +67,7 @@ def make_base_content_rules(user):
 def make_base_override_rules():
     return [
         {
+            'rule_id': '.m.rule.contains_display_name',
             'conditions': [
                 {
                     'kind': 'contains_display_name'
@@ -80,6 +82,7 @@ def make_base_override_rules():
             ]
         },
         {
+            'rule_id': '.m.rule.room_two_members',
             'conditions': [
                 {
                     'kind': 'room_member_count',