Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4a3e6c7

Browse files
committedMar 9, 2024·
update only if needed auth events exist
1 parent c6a0de8 commit 4a3e6c7

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed
 

‎synapse/event_auth.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -189,23 +189,20 @@ async def check_state_independent_auth_rules(
189189
# 2. Reject if event has auth_events that: ...
190190
auth_events: MutableMapping[str, "EventBase"] = {}
191191
if batched_auth_events:
192+
auth_events = cast(MutableMapping[str, "EventBase"], batched_auth_events)
192193
needed_auth_event_ids = [
193194
event_id
194195
for event_id in event.auth_event_ids()
195196
if event_id not in batched_auth_events
196197
]
197-
198-
needed_auth_events: MutableMapping[str, "EventBase"] = {}
199-
200198
if needed_auth_event_ids:
201-
needed_auth_events = await store.get_events(
202-
needed_auth_event_ids,
203-
redact_behaviour=EventRedactBehaviour.as_is,
204-
allow_rejected=True,
199+
auth_events.update(
200+
await store.get_events(
201+
needed_auth_event_ids,
202+
redact_behaviour=EventRedactBehaviour.as_is,
203+
allow_rejected=True,
204+
)
205205
)
206-
207-
auth_events = cast(MutableMapping[str, "EventBase"], batched_auth_events)
208-
auth_events.update(needed_auth_events)
209206
else:
210207
auth_events = await store.get_events(
211208
event.auth_event_ids(),

0 commit comments

Comments
 (0)
Please sign in to comment.