diff --git a/changelog.d/19787.bugfix b/changelog.d/19787.bugfix new file mode 100644 index 0000000000..26bd3e2252 --- /dev/null +++ b/changelog.d/19787.bugfix @@ -0,0 +1 @@ +Fix `/sync` failing when [MSC4354 Sticky Events](https://github.com/matrix-org/matrix-spec-proposals/pull/4354) are enabled and the sync request filters out Ephemeral Data Units (EDUs). \ No newline at end of file diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index bca51b64b7..9ecfe0da0f 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -2236,19 +2236,23 @@ class SyncHandler: if block_all_room_ephemeral: ephemeral_by_room: dict[str, list[JsonDict]] = {} else: - now_token, ephemeral_by_room = await self.ephemeral_by_room( + ( + sync_result_builder.now_token, + ephemeral_by_room, + ) = await self.ephemeral_by_room( sync_result_builder, now_token=sync_result_builder.now_token, since_token=sync_result_builder.since_token, ) - sync_result_builder.now_token = now_token sticky_by_room: dict[str, list[str]] = {} if self.hs_config.experimental.msc4354_enabled: - now_token, sticky_by_room = await self.sticky_events_by_room( - sync_result_builder, now_token, since_token + ( + sync_result_builder.now_token, + sticky_by_room, + ) = await self.sticky_events_by_room( + sync_result_builder, sync_result_builder.now_token, since_token ) - sync_result_builder.now_token = now_token # 2. We check up front if anything has changed, if it hasn't then there is # no point in going further.