From 04f8478aaa02d11ce079d1eaeabcfba88b1fcee7 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 10 Mar 2015 17:26:25 +0000 Subject: Add the master push rule for the break-my-push button. Allow server default rules to be disabled by default. --- synapse/push/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'synapse/push/__init__.py') diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py index 3da0ce8703..c98aca60b9 100644 --- a/synapse/push/__init__.py +++ b/synapse/push/__init__.py @@ -105,7 +105,11 @@ 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']]: + if r['rule_id'] in enabled_map: + r['enabled'] = enabled_map[r['rule_id']] + elif 'enabled' not in r: + r['enabled'] = True + if not r['enabled']: continue matches = True -- cgit 1.4.1 From cdb2e045eed71b58c3e14471d9fb8c6ff1cf490d Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 11 Mar 2015 14:22:35 +0000 Subject: Again, underscore, not hyphen --- synapse/push/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'synapse/push/__init__.py') diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py index c98aca60b9..d69c92911f 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 = ['dont-notify'] + DEFAULT_ACTIONS = ['dont_notify'] INEQUALITY_EXPR = re.compile("^([=<>]*)([0-9]*)$") -- cgit 1.4.1 From c92fdf88a34c22b3147f0a674633cea33ada4b99 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 11 Mar 2015 22:17:31 +0000 Subject: Log the matching push rule. --- synapse/push/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'synapse/push/__init__.py') diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py index d69c92911f..5056374eb9 100644 --- a/synapse/push/__init__.py +++ b/synapse/push/__init__.py @@ -128,13 +128,15 @@ class Pusher(object): # 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" % - (r['rule_id'], r['user_name']) + "Ignoring rule id %s with no actions for user %s", + r['rule_id'], self.user_name ) continue if matches: + logger.info("%s matches for user %s, event %s", r['rule_id'], self.user_name, ev['event_id']) defer.returnValue(actions) + logger.info("No rules match for user %s, event %s", self.user_name, ev['event_id']) defer.returnValue(Pusher.DEFAULT_ACTIONS) @staticmethod -- cgit 1.4.1 From bbb010a30fe4beb6104e7d185e722a76c88825ff Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 12 Mar 2015 16:53:12 +0000 Subject: More sacrifices to the pep8 gods. --- synapse/push/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'synapse/push/__init__.py') diff --git a/synapse/push/__init__.py b/synapse/push/__init__.py index 5056374eb9..0727f772a5 100644 --- a/synapse/push/__init__.py +++ b/synapse/push/__init__.py @@ -133,10 +133,16 @@ class Pusher(object): ) continue if matches: - logger.info("%s matches for user %s, event %s", r['rule_id'], self.user_name, ev['event_id']) + logger.info( + "%s matches for user %s, event %s", + r['rule_id'], self.user_name, ev['event_id'] + ) defer.returnValue(actions) - logger.info("No rules match for user %s, event %s", self.user_name, ev['event_id']) + logger.info( + "No rules match for user %s, event %s", + self.user_name, ev['event_id'] + ) defer.returnValue(Pusher.DEFAULT_ACTIONS) @staticmethod -- cgit 1.4.1