mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-28 21:22:02 +00:00
s/user_name/user/ as per mjark's comment
This commit is contained in:
parent
09f9e8493c
commit
6fab7bd2c1
@ -76,13 +76,13 @@ class Pusher(object):
|
|||||||
if ev['state_key'] != self.user_name:
|
if ev['state_key'] != self.user_name:
|
||||||
defer.returnValue(['dont_notify'])
|
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:
|
for r in rawrules:
|
||||||
r['conditions'] = json.loads(r['conditions'])
|
r['conditions'] = json.loads(r['conditions'])
|
||||||
r['actions'] = json.loads(r['actions'])
|
r['actions'] = json.loads(r['actions'])
|
||||||
|
|
||||||
enabled_map = yield self.store.get_push_rules_enabled_for_user_name(self.user_name)
|
enabled_map = yield self.store.get_push_rules_enabled_for_user(self.user_name)
|
||||||
|
|
||||||
user = UserID.from_string(self.user_name)
|
user = UserID.from_string(self.user_name)
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
|
|||||||
# we build up the full structure and then decide which bits of it
|
# we build up the full structure and then decide which bits of it
|
||||||
# to send which means doing unnecessary work sometimes but is
|
# to send which means doing unnecessary work sometimes but is
|
||||||
# is probably not going to make a whole lot of difference
|
# is probably not going to make a whole lot of difference
|
||||||
rawrules = yield self.hs.get_datastore().get_push_rules_for_user_name(
|
rawrules = yield self.hs.get_datastore().get_push_rules_for_user(
|
||||||
user.to_string()
|
user.to_string()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
|
|||||||
rules['global'] = _add_empty_priority_class_arrays(rules['global'])
|
rules['global'] = _add_empty_priority_class_arrays(rules['global'])
|
||||||
|
|
||||||
enabled_map = yield self.hs.get_datastore().\
|
enabled_map = yield self.hs.get_datastore().\
|
||||||
get_push_rules_enabled_for_user_name(user.to_string())
|
get_push_rules_enabled_for_user(user.to_string())
|
||||||
|
|
||||||
for r in ruleslist:
|
for r in ruleslist:
|
||||||
rulearray = None
|
rulearray = None
|
||||||
@ -212,7 +212,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
|
|||||||
|
|
||||||
def get_rule_attr(self, user_name, namespaced_rule_id, attr):
|
def get_rule_attr(self, user_name, namespaced_rule_id, attr):
|
||||||
if attr == 'enabled':
|
if attr == 'enabled':
|
||||||
return self.hs.get_datastore().get_push_rule_enabled_by_user_name_rule_id(
|
return self.hs.get_datastore().get_push_rule_enabled_by_user_rule_id(
|
||||||
user_name, namespaced_rule_id
|
user_name, namespaced_rule_id
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -27,7 +27,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class PushRuleStore(SQLBaseStore):
|
class PushRuleStore(SQLBaseStore):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_push_rules_for_user_name(self, user_name):
|
def get_push_rules_for_user(self, user_name):
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT "+",".join(PushRuleTable.fields)+" "
|
"SELECT "+",".join(PushRuleTable.fields)+" "
|
||||||
"FROM "+PushRuleTable.table_name+" "
|
"FROM "+PushRuleTable.table_name+" "
|
||||||
@ -46,7 +46,7 @@ class PushRuleStore(SQLBaseStore):
|
|||||||
defer.returnValue(dicts)
|
defer.returnValue(dicts)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_push_rules_enabled_for_user_name(self, user_name):
|
def get_push_rules_enabled_for_user(self, user_name):
|
||||||
results = yield self._simple_select_list(
|
results = yield self._simple_select_list(
|
||||||
PushRuleEnableTable.table_name,
|
PushRuleEnableTable.table_name,
|
||||||
{'user_name': user_name},
|
{'user_name': user_name},
|
||||||
@ -57,7 +57,7 @@ class PushRuleStore(SQLBaseStore):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_push_rule_enabled_by_user_name_rule_id(self, user_name, rule_id):
|
def get_push_rule_enabled_by_user_rule_id(self, user_name, rule_id):
|
||||||
results = yield self._simple_select_list(
|
results = yield self._simple_select_list(
|
||||||
PushRuleEnableTable.table_name,
|
PushRuleEnableTable.table_name,
|
||||||
{'user_name': user_name, 'rule_id': rule_id},
|
{'user_name': user_name, 'rule_id': rule_id},
|
||||||
|
Loading…
Reference in New Issue
Block a user