Skip to content

Commit

Permalink
update only if needed auth events exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ggogel committed Mar 9, 2024
1 parent c6a0de8 commit 44411a2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions synapse/event_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,23 +189,19 @@ async def check_state_independent_auth_rules(
# 2. Reject if event has auth_events that: ...
auth_events: MutableMapping[str, "EventBase"] = {}
if batched_auth_events:
auth_events = cast(MutableMapping[str, "EventBase"], batched_auth_events)
needed_auth_event_ids = [
event_id
for event_id in event.auth_event_ids()
if event_id not in batched_auth_events
]

needed_auth_events: MutableMapping[str, "EventBase"] = {}

if needed_auth_event_ids:
needed_auth_events = await store.get_events(
needed_auth_event_ids,
redact_behaviour=EventRedactBehaviour.as_is,
allow_rejected=True,
)

auth_events = cast(MutableMapping[str, "EventBase"], batched_auth_events)
auth_events.update(needed_auth_events)
auth_events.update(needed_auth_events)
else:
auth_events = await store.get_events(
event.auth_event_ids(),
Expand Down

0 comments on commit 44411a2

Please sign in to comment.