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

Don't create broken room when power_level_content_override.users does not contain creator_id. #5633

Merged
1 change: 1 addition & 0 deletions changelog.d/5633.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix createRoom power_level_content_override behaviour to match the spec.
9 changes: 8 additions & 1 deletion synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,14 @@ def send(etype, content, **kwargs):
power_level_content["users"][invitee] = 100

if power_level_content_override:
power_level_content.update(power_level_content_override)
power_level_content = power_level_content_override
t3chguy marked this conversation as resolved.
Show resolved Hide resolved

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)

Expand Down