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
c91045f5
Commit
c91045f5
authored
4 years ago
by
Jason Robinson
Browse files
Options
Downloads
Patches
Plain Diff
Move unknown room ID error into resolve_room_id
Signed-off-by:
Jason Robinson
<
jasonr@matrix.org
>
parent
b849e461
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/rest/admin/rooms.py
+9
-7
9 additions, 7 deletions
synapse/rest/admin/rooms.py
with
9 additions
and
7 deletions
synapse/rest/admin/rooms.py
+
9
−
7
View file @
c91045f5
...
...
@@ -524,14 +524,18 @@ class ForwardExtremitiesRestServlet(RestServlet):
async
def
resolve_room_id
(
self
,
room_identifier
:
str
)
->
str
:
"""
Resolve to a room ID, if necessary.
"""
if
RoomID
.
is_valid
(
room_identifier
):
r
eturn
room_identifier
r
oom_id
=
room_identifier
elif
RoomAlias
.
is_valid
(
room_identifier
):
room_alias
=
RoomAlias
.
from_string
(
room_identifier
)
room_id
,
_
=
await
self
.
room_member_handler
.
lookup_room_alias
(
room_alias
)
return
room_id
.
to_string
()
raise
SynapseError
(
400
,
"
%s was not legal room ID or room alias
"
%
(
room_identifier
,)
)
room_id
=
room_id
.
to_string
()
else
:
raise
SynapseError
(
400
,
"
%s was not legal room ID or room alias
"
%
(
room_identifier
,)
)
if
not
room_id
:
raise
SynapseError
(
400
,
"
Unknown room ID or room alias %s
"
%
room_identifier
)
return
room_id
async
def
on_DELETE
(
self
,
request
,
room_identifier
):
requester
=
await
self
.
auth
.
get_user_by_req
(
request
)
...
...
@@ -544,8 +548,6 @@ class ForwardExtremitiesRestServlet(RestServlet):
await
assert_user_is_admin
(
self
.
auth
,
requester
.
user
)
room_id
=
await
self
.
resolve_room_id
(
room_identifier
)
if
not
room_id
:
raise
SynapseError
(
400
,
"
Unknown room ID or room alias %s
"
%
room_identifier
)
extremities
=
await
self
.
store
.
get_forward_extremities_for_room
(
room_id
)
return
200
,
{
...
...
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