diff --git a/synapse/event_auth.py b/synapse/event_auth.py index dba1f6841d..0b2c741398 100644 --- a/synapse/event_auth.py +++ b/synapse/event_auth.py @@ -828,8 +828,8 @@ def _can_send_event(event: "EventBase", auth_events: StateMap["EventBase"]) -> b # Check state_key if hasattr(event, "state_key"): if event.state_key.startswith("@"): - if event.state_key != event.user_id and ( - not use_msc3779 or not event.state_key.startswith(event.user_id + "_") + if event.state_key != event.user_id and not ( + use_msc3779 and event.state_key.startswith(event.user_id + "_") ): raise AuthError(403, "You are not allowed to set others state")