diff --git a/synapse/push/action_generator.py b/synapse/push/action_generator.py
index 46e768e35c..b2c94bfaac 100644
--- a/synapse/push/action_generator.py
+++ b/synapse/push/action_generator.py
@@ -38,15 +38,16 @@ class ActionGenerator:
@defer.inlineCallbacks
def handle_push_actions_for_event(self, event, context):
- with Measure(self.clock, "handle_push_actions_for_event"):
+ with Measure(self.clock, "evaluator_for_event"):
bulk_evaluator = yield evaluator_for_event(
event, self.hs, self.store, context.current_state
)
+ with Measure(self.clock, "action_for_event_by_user"):
actions_by_user = yield bulk_evaluator.action_for_event_by_user(
event, context.current_state
)
- context.push_actions = [
- (uid, actions) for uid, actions in actions_by_user.items()
- ]
+ context.push_actions = [
+ (uid, actions) for uid, actions in actions_by_user.items()
+ ]
diff --git a/synapse/push/baserules.py b/synapse/push/baserules.py
index 024c14904f..edb00ed206 100644
--- a/synapse/push/baserules.py
+++ b/synapse/push/baserules.py
@@ -217,45 +217,49 @@ BASE_APPEND_OVERRIDE_RULES = [
'dont_notify'
]
},
-]
-
-
-BASE_APPEND_UNDERRIDE_RULES = [
+ # This was changed from underride to override so it's closer in priority
+ # to the content rules where the user name highlight rule lives. This
+ # way a room rule is lower priority than both but a custom override rule
+ # is higher priority than both.
{
- 'rule_id': 'global/underride/.m.rule.call',
+ 'rule_id': 'global/override/.m.rule.contains_display_name',
'conditions': [
{
- 'kind': 'event_match',
- 'key': 'type',
- 'pattern': 'm.call.invite',
- '_id': '_call',
+ 'kind': 'contains_display_name'
}
],
'actions': [
'notify',
{
'set_tweak': 'sound',
- 'value': 'ring'
+ 'value': 'default'
}, {
- 'set_tweak': 'highlight',
- 'value': False
+ 'set_tweak': 'highlight'
}
]
},
+]
+
+
+BASE_APPEND_UNDERRIDE_RULES = [
{
- 'rule_id': 'global/underride/.m.rule.contains_display_name',
+ 'rule_id': 'global/underride/.m.rule.call',
'conditions': [
{
- 'kind': 'contains_display_name'
+ 'kind': 'event_match',
+ 'key': 'type',
+ 'pattern': 'm.call.invite',
+ '_id': '_call',
}
],
'actions': [
'notify',
{
'set_tweak': 'sound',
- 'value': 'default'
+ 'value': 'ring'
}, {
- 'set_tweak': 'highlight'
+ 'set_tweak': 'highlight',
+ 'value': False
}
]
},
diff --git a/synapse/push/pusherpool.py b/synapse/push/pusherpool.py
index 5853ec36a9..54c0f1b849 100644
--- a/synapse/push/pusherpool.py
+++ b/synapse/push/pusherpool.py
@@ -102,14 +102,14 @@ class PusherPool:
yield self.remove_pusher(p['app_id'], p['pushkey'], p['user_name'])
@defer.inlineCallbacks
- def remove_pushers_by_user(self, user_id, except_token_ids=[]):
+ def remove_pushers_by_user(self, user_id, except_access_token_id=None):
all = yield self.store.get_all_pushers()
logger.info(
- "Removing all pushers for user %s except access tokens ids %r",
- user_id, except_token_ids
+ "Removing all pushers for user %s except access tokens id %r",
+ user_id, except_access_token_id
)
for p in all:
- if p['user_name'] == user_id and p['access_token'] not in except_token_ids:
+ if p['user_name'] == user_id and p['access_token'] != except_access_token_id:
logger.info(
"Removing pusher for app id %s, pushkey %s, user %s",
p['app_id'], p['pushkey'], p['user_name']
|