Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Don't create broken room when power_level_content_override.users does…
Browse files Browse the repository at this point in the history
… not contain creator_id. (#5633)
  • Loading branch information
anoadragon453 committed Feb 20, 2020
2 parents 480d7e2 + baee288 commit 96efc4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/5633.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't create broken room when power_level_content_override.users does not contain creator_id.
14 changes: 13 additions & 1 deletion synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,18 @@ def create_room(self, requester, config, ratelimit=True, creator_join_profile=No

yield self.event_creation_handler.assert_accepted_privacy_policy(requester)

power_level_content_override = config.get("power_level_content_override")
if (
power_level_content_override
and "users" in power_level_content_override
and user_id not in power_level_content_override["users"]
):
raise SynapseError(
400,
"Not a valid power_level_content_override: 'users' did not contain %s"
% (user_id,),
)

visibility = config.get("visibility", None)
is_public = visibility == "public"

Expand Down Expand Up @@ -621,7 +633,7 @@ def create_room(self, requester, config, ratelimit=True, creator_join_profile=No
initial_state=initial_state,
creation_content=creation_content,
room_alias=room_alias,
power_level_content_override=config.get("power_level_content_override"),
power_level_content_override=power_level_content_override,
creator_join_profile=creator_join_profile,
)

Expand Down

0 comments on commit 96efc4d

Please sign in to comment.