diff options
author | David Baker <dave@matrix.org> | 2015-03-10 17:26:25 +0000 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2015-03-10 17:26:25 +0000 |
commit | 04f8478aaa02d11ce079d1eaeabcfba88b1fcee7 (patch) | |
tree | 5ca8117876ce9507421c5e4c53c117a7171e6577 /synapse/storage/push_rule.py | |
parent | These aren't defined for redacted events so don't crash (diff) | |
download | synapse-04f8478aaa02d11ce079d1eaeabcfba88b1fcee7.tar.xz |
Add the master push rule for the break-my-push button. Allow server default rules to be disabled by default.
Diffstat (limited to 'synapse/storage/push_rule.py')
-rw-r--r-- | synapse/storage/push_rule.py | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/synapse/storage/push_rule.py b/synapse/storage/push_rule.py index bbf322cc84..1628489fa7 100644 --- a/synapse/storage/push_rule.py +++ b/synapse/storage/push_rule.py @@ -57,17 +57,6 @@ class PushRuleStore(SQLBaseStore): ) @defer.inlineCallbacks - def get_push_rule_enabled_by_user_rule_id(self, user_name, rule_id): - results = yield self._simple_select_list( - PushRuleEnableTable.table_name, - {'user_name': user_name, 'rule_id': rule_id}, - ['enabled'] - ) - if not results: - defer.returnValue(True) - defer.returnValue(results[0]) - - @defer.inlineCallbacks def add_push_rule(self, before, after, **kwargs): vals = copy.copy(kwargs) if 'conditions' in vals: @@ -217,17 +206,11 @@ class PushRuleStore(SQLBaseStore): @defer.inlineCallbacks def set_push_rule_enabled(self, user_name, rule_id, enabled): - if enabled: - yield self._simple_delete_one( - PushRuleEnableTable.table_name, - {'user_name': user_name, 'rule_id': rule_id} - ) - else: - yield self._simple_upsert( - PushRuleEnableTable.table_name, - {'user_name': user_name, 'rule_id': rule_id}, - {'enabled': False} - ) + yield self._simple_upsert( + PushRuleEnableTable.table_name, + {'user_name': user_name, 'rule_id': rule_id}, + {'enabled': enabled} + ) class RuleNotFoundException(Exception): |