Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
7 changes: 4 additions & 3 deletions synapse/third_party_rules/access_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ async def check_event_allowed(
self,
event: EventBase,
state_events: StateMap[EventBase],
) -> bool:
) -> Union[bool, dict]:
"""Implements synapse.events.ThirdPartyEventRules.check_event_allowed.

Checks the event's type and the current rule and calls the right function to
Expand All @@ -334,7 +334,8 @@ async def check_event_allowed(
State events in the room the event originated from.

Returns:
True if the event can be allowed, False otherwise.
True if the event can be allowed, False otherwise, or a dictionary if the
event needs to be rebuilt (containing the event's new content).
"""
if event.type == FROZEN_STATE_TYPE:
return await self._on_frozen_state_change(event, state_events)
Expand Down Expand Up @@ -441,7 +442,7 @@ async def _on_event_when_frozen(
# themselves as admin.
current_power_levels = state_events.get((EventTypes.PowerLevels, ""))
if current_power_levels:
old_content = current_power_levels.content
old_content = current_power_levels.content.copy()
old_content["users_default"] = 0

new_content = unfreeze(event.content)
Expand Down