Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
2e77ba63
Commit
2e77ba63
authored
10 years ago
by
David Baker
Browse files
Options
Downloads
Patches
Plain Diff
More s/instance_handle/profile_tag/
parent
dc7bb70f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/rest/client/v1/push_rule.py
+5
-5
5 additions, 5 deletions
synapse/rest/client/v1/push_rule.py
with
5 additions
and
5 deletions
synapse/rest/client/v1/push_rule.py
+
5
−
5
View file @
2e77ba63
...
@@ -73,7 +73,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
...
@@ -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):
...
@@ -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):
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment