diff options
author | Erik Johnston <erik@matrix.org> | 2016-01-29 13:52:12 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-01-29 13:52:12 +0000 |
commit | fd142c29d9af53fe76dcf0cb4e1ebe7aac5d28f2 (patch) | |
tree | fd4650925097b4014e8ce32619ab4956a0a89879 /synapse/rest/client | |
parent | Bump version and changelog (diff) | |
parent | Bump AccountDataAndTagsChangeCache size (diff) | |
download | synapse-fd142c29d9af53fe76dcf0cb4e1ebe7aac5d28f2.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.12.1
Diffstat (limited to 'synapse/rest/client')
-rw-r--r-- | synapse/rest/client/v1/push_rule.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/synapse/rest/client/v1/push_rule.py b/synapse/rest/client/v1/push_rule.py index cb3ec23872..96633a176c 100644 --- a/synapse/rest/client/v1/push_rule.py +++ b/synapse/rest/client/v1/push_rule.py @@ -66,11 +66,12 @@ class PushRuleRestServlet(ClientV1RestServlet): raise SynapseError(400, e.message) before = request.args.get("before", None) - if before and len(before): - before = before[0] + if before: + before = _namespaced_rule_id(spec, before[0]) + after = request.args.get("after", None) - if after and len(after): - after = after[0] + if after: + after = _namespaced_rule_id(spec, after[0]) try: yield self.hs.get_datastore().add_push_rule( @@ -452,11 +453,15 @@ def _strip_device_condition(rule): def _namespaced_rule_id_from_spec(spec): + return _namespaced_rule_id(spec, spec['rule_id']) + + +def _namespaced_rule_id(spec, rule_id): if spec['scope'] == 'global': scope = 'global' else: scope = 'device/%s' % (spec['profile_tag']) - return "%s/%s/%s" % (scope, spec['template'], spec['rule_id']) + return "%s/%s/%s" % (scope, spec['template'], rule_id) def _rule_id_from_namespaced(in_rule_id): |