Move power_level_content_override.users check before room creation

This commit is contained in:
Michael Telatynski 2019-07-29 17:14:47 +01:00
parent f7e96e765d
commit dc0657f0e6

View file

@ -560,6 +560,14 @@ class RoomCreationHandler(BaseHandler):
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 user_id not in power_level_content_override["users"]:
raise SynapseError(
400,
"Not a valid power_level_content_override, did not contain %s"
% (user_id,),
)
invite_3pid_list = config.get("invite_3pid", [])
visibility = config.get("visibility", None)
@ -604,7 +612,7 @@ class RoomCreationHandler(BaseHandler):
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,
)
@ -752,13 +760,6 @@ class RoomCreationHandler(BaseHandler):
if power_level_content_override:
power_level_content.update(power_level_content_override)
if creator_id not in power_level_content["users"]:
raise SynapseError(
400,
"Not a valid power_level_content_override, did not contain %s"
% (creator_id,),
)
yield send(etype=EventTypes.PowerLevels, content=power_level_content)
if room_alias and (EventTypes.CanonicalAlias, "") not in initial_state: