mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
More s/instance_handle/profile_tag/
This commit is contained in:
parent
dc7bb70f22
commit
2e77ba637a
@ -73,7 +73,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
|
|||||||
'rule_id': rule_id
|
'rule_id': rule_id
|
||||||
}
|
}
|
||||||
if device:
|
if device:
|
||||||
spec['device'] = device
|
spec['profile_tag'] = device
|
||||||
return spec
|
return spec
|
||||||
|
|
||||||
def rule_tuple_from_request_object(self, rule_template, rule_id, req_obj, device=None):
|
def rule_tuple_from_request_object(self, rule_template, rule_id, req_obj, device=None):
|
||||||
@ -188,15 +188,15 @@ class PushRuleRestServlet(ClientV1RestServlet):
|
|||||||
|
|
||||||
user, _ = yield self.auth.get_user_by_req(request)
|
user, _ = yield self.auth.get_user_by_req(request)
|
||||||
|
|
||||||
if 'device' in spec:
|
if 'profile_tag' in spec:
|
||||||
rules = yield self.hs.get_datastore().get_push_rules_for_user_name(
|
rules = yield self.hs.get_datastore().get_push_rules_for_user_name(
|
||||||
user.to_string()
|
user.to_string()
|
||||||
)
|
)
|
||||||
|
|
||||||
for r in rules:
|
for r in rules:
|
||||||
conditions = json.loads(r['conditions'])
|
conditions = json.loads(r['conditions'])
|
||||||
ih = _profile_tag_from_conditions(conditions)
|
pt = _profile_tag_from_conditions(conditions)
|
||||||
if ih == spec['device'] and r['priority_class'] == priority_class:
|
if pt == spec['profile_tag'] and r['priority_class'] == priority_class:
|
||||||
yield self.hs.get_datastore().delete_push_rule(
|
yield self.hs.get_datastore().delete_push_rule(
|
||||||
user.to_string(), spec['rule_id']
|
user.to_string(), spec['rule_id']
|
||||||
)
|
)
|
||||||
@ -306,7 +306,7 @@ def _add_empty_priority_class_arrays(d):
|
|||||||
|
|
||||||
def _profile_tag_from_conditions(conditions):
|
def _profile_tag_from_conditions(conditions):
|
||||||
"""
|
"""
|
||||||
Given a list of conditions, return the instance handle of the
|
Given a list of conditions, return the profile tag of the
|
||||||
device rule if there is one
|
device rule if there is one
|
||||||
"""
|
"""
|
||||||
for c in conditions:
|
for c in conditions:
|
||||||
|
Loading…
Reference in New Issue
Block a user