From fabd6fe3e4a4a88c238b877aa989f39706376bc4 Mon Sep 17 00:00:00 2001 From: Mathieu Velten Date: Wed, 13 Nov 2024 14:34:48 +0100 Subject: [PATCH] Fix bug when rejecting withdrew invite with a third_party_rules module --- synapse/events/snapshot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/synapse/events/snapshot.py b/synapse/events/snapshot.py index dd21a6136b..6c0542896f 100644 --- a/synapse/events/snapshot.py +++ b/synapse/events/snapshot.py @@ -269,7 +269,8 @@ class EventContext(UnpersistedEventContextBase): if self.rejected: raise RuntimeError("Attempt to access state_ids of rejected event") - assert self._state_delta_due_to_event is not None + if self._state_delta_due_to_event is None: + return None prev_state_ids = await self.get_prev_state_ids(state_filter) @@ -300,7 +301,8 @@ class EventContext(UnpersistedEventContextBase): this tuple. """ - assert self.state_group_before_event is not None + if self.state_group_before_event is None: + return {} return await self._storage.state.get_state_ids_for_group( self.state_group_before_event, state_filter )