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
Package registry
Container registry
Model registry
Operate
Terraform modules
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
Timo Ley
synapse
Commits
fd2fcb81
Unverified
Commit
fd2fcb81
authored
6 years ago
by
Erik Johnston
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #5070 from matrix-org/erikj/postpath
Remove usage of request.postpath
parents
a1eb4c6d
14d5ad7d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/5070.feature
+1
-0
1 addition, 0 deletions
changelog.d/5070.feature
synapse/rest/client/v1/push_rule.py
+8
-8
8 additions, 8 deletions
synapse/rest/client/v1/push_rule.py
with
9 additions
and
8 deletions
changelog.d/5070.feature
0 → 100644
+
1
−
0
View file @
fd2fcb81
Add
support
for
handling
/verions,
/voip
and
/push_rules
client
endpoints
to
client_reader
worker.
This diff is collapsed.
Click to expand it.
synapse/rest/client/v1/push_rule.py
+
8
−
8
View file @
fd2fcb81
...
...
@@ -31,7 +31,7 @@ from .base import ClientV1RestServlet, client_path_patterns
class
PushRuleRestServlet
(
ClientV1RestServlet
):
PATTERNS
=
client_path_patterns
(
"
/pushrules/.*$
"
)
PATTERNS
=
client_path_patterns
(
"
/
(?P<path>
pushrules/.*
)
$
"
)
SLIGHTLY_PEDANTIC_TRAILING_SLASH_ERROR
=
(
"
Unrecognised request: You probably wanted a trailing slash
"
)
...
...
@@ -42,11 +42,11 @@ class PushRuleRestServlet(ClientV1RestServlet):
self
.
_is_worker
=
hs
.
config
.
worker_app
is
not
None
@defer.inlineCallbacks
def
on_PUT
(
self
,
request
):
def
on_PUT
(
self
,
request
,
path
):
if
self
.
_is_worker
:
raise
Exception
(
"
Cannot handle PUT /push_rules on worker
"
)
spec
=
_rule_spec_from_path
([
x
.
decode
(
'
utf8
'
)
for
x
in
request
.
postpath
])
spec
=
_rule_spec_from_path
([
x
for
x
in
path
.
split
(
"
/
"
)
])
try
:
priority_class
=
_priority_class_from_spec
(
spec
)
except
InvalidRuleException
as
e
:
...
...
@@ -106,11 +106,11 @@ class PushRuleRestServlet(ClientV1RestServlet):
defer
.
returnValue
((
200
,
{}))
@defer.inlineCallbacks
def
on_DELETE
(
self
,
request
):
def
on_DELETE
(
self
,
request
,
path
):
if
self
.
_is_worker
:
raise
Exception
(
"
Cannot handle DELETE /push_rules on worker
"
)
spec
=
_rule_spec_from_path
([
x
.
decode
(
'
utf8
'
)
for
x
in
request
.
postpath
])
spec
=
_rule_spec_from_path
([
x
for
x
in
path
.
split
(
"
/
"
)
])
requester
=
yield
self
.
auth
.
get_user_by_req
(
request
)
user_id
=
requester
.
user
.
to_string
()
...
...
@@ -130,7 +130,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
raise
@defer.inlineCallbacks
def
on_GET
(
self
,
request
):
def
on_GET
(
self
,
request
,
path
):
requester
=
yield
self
.
auth
.
get_user_by_req
(
request
)
user_id
=
requester
.
user
.
to_string
()
...
...
@@ -141,7 +141,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
rules
=
format_push_rules_for_user
(
requester
.
user
,
rules
)
path
=
[
x
.
decode
(
'
utf8
'
)
for
x
in
request
.
postpath
][
1
:]
path
=
[
x
for
x
in
path
.
split
(
"
/
"
)
][
1
:]
if
path
==
[]:
# we're a reference impl: pedantry is our job.
...
...
@@ -157,7 +157,7 @@ class PushRuleRestServlet(ClientV1RestServlet):
else
:
raise
UnrecognizedRequestError
()
def
on_OPTIONS
(
self
,
_
):
def
on_OPTIONS
(
self
,
request
,
path
):
return
200
,
{}
def
notify_user
(
self
,
user_id
):
...
...
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