diff options
author | Kegan Dougal <kegan@matrix.org> | 2015-03-06 17:28:49 +0000 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2015-03-06 17:28:49 +0000 |
commit | 34ce2ca62f261311a9082b6e243eb6c584487025 (patch) | |
tree | 0144c0f0a8231e2ea68e23c7d5676f48e42ee775 /synapse/push/__init__.py | |
parent | Assign the AS ID from the database; replace old placeholder txn id. (diff) | |
parent | When setting display name more graciously handle failures to update room state. (diff) | |
download | synapse-34ce2ca62f261311a9082b6e243eb6c584487025.tar.xz |
Merge branch 'develop' into application-services-txn-reliability
Diffstat (limited to 'synapse/push/__init__.py')
-rw-r--r-- | synapse/push/__init__.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py index 0fb3e4f7f3..3da0ce8703 100644 --- a/synapse/push/__init__.py +++ b/synapse/push/__init__.py @@ -32,7 +32,7 @@ class Pusher(object): INITIAL_BACKOFF = 1000 MAX_BACKOFF = 60 * 60 * 1000 GIVE_UP_AFTER = 24 * 60 * 60 * 1000 - DEFAULT_ACTIONS = ['notify'] + DEFAULT_ACTIONS = ['dont-notify'] INEQUALITY_EXPR = re.compile("^([=<>]*)([0-9]*)$") @@ -72,16 +72,14 @@ class Pusher(object): # let's assume you probably know about messages you sent yourself defer.returnValue(['dont_notify']) - if ev['type'] == 'm.room.member': - if ev['state_key'] != self.user_name: - defer.returnValue(['dont_notify']) - - rawrules = yield self.store.get_push_rules_for_user_name(self.user_name) + rawrules = yield self.store.get_push_rules_for_user(self.user_name) for r in rawrules: r['conditions'] = json.loads(r['conditions']) r['actions'] = json.loads(r['actions']) + enabled_map = yield self.store.get_push_rules_enabled_for_user(self.user_name) + user = UserID.from_string(self.user_name) rules = baserules.list_with_base_rules(rawrules, user) @@ -107,6 +105,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'] @@ -117,7 +117,11 @@ class Pusher(object): ev, c, display_name=my_display_name, room_member_count=room_member_count ) - # ignore rules with no actions (we have an explict 'dont_notify' + logger.debug( + "Rule %s %s", + r['rule_id'], "matches" if matches else "doesn't match" + ) + # ignore rules with no actions (we have an explict 'dont_notify') if len(actions) == 0: logger.warn( "Ignoring rule id %s with no actions for user %s" % |