mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 13:46:02 -04:00
Add enable/disable overlay for push rules (REST API not yet hooked up)
This commit is contained in:
parent
a025055643
commit
94fa334b01
5 changed files with 46 additions and 0 deletions
|
@ -45,6 +45,17 @@ class PushRuleStore(SQLBaseStore):
|
|||
|
||||
defer.returnValue(dicts)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_push_rules_enabled_for_user_name(self, user_name):
|
||||
results = yield self._simple_select_list(
|
||||
PushRuleEnableTable.table_name,
|
||||
{'user_name': user_name},
|
||||
PushRuleEnableTable.fields
|
||||
)
|
||||
defer.returnValue(
|
||||
{r['rule_id']: False if r['enabled'] == 0 else True for r in results}
|
||||
)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def add_push_rule(self, before, after, **kwargs):
|
||||
vals = copy.copy(kwargs)
|
||||
|
@ -216,3 +227,12 @@ class PushRuleTable(Table):
|
|||
]
|
||||
|
||||
EntryType = collections.namedtuple("PushRuleEntry", fields)
|
||||
|
||||
class PushRuleEnableTable(Table):
|
||||
table_name = "push_rules_enable"
|
||||
|
||||
fields = [
|
||||
"user_name",
|
||||
"rule_id",
|
||||
"enabled"
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue