Use fewer "not"s

This commit is contained in:
Andrew Ferrazzutti 2024-06-27 15:26:52 -04:00
parent c8aae9832c
commit 44e4a81624

View file

@ -828,8 +828,8 @@ def _can_send_event(event: "EventBase", auth_events: StateMap["EventBase"]) -> b
# Check state_key # Check state_key
if hasattr(event, "state_key"): if hasattr(event, "state_key"):
if event.state_key.startswith("@"): if event.state_key.startswith("@"):
if event.state_key != event.user_id and ( if event.state_key != event.user_id and not (
not use_msc3779 or not event.state_key.startswith(event.user_id + "_") use_msc3779 and event.state_key.startswith(event.user_id + "_")
): ):
raise AuthError(403, "You are not allowed to set others state") raise AuthError(403, "You are not allowed to set others state")