Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/19464.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `/sync` `timeline` state duplicated in `state` when lazy-loading.
10 changes: 7 additions & 3 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,13 @@ async def compute_state_delta(
if event.sender not in first_event_by_sender_map:
first_event_by_sender_map[event.sender] = event

# Add to the `timeline_state` first before we check whether members
# are in the `timeline` just below. Otherwise, we will end up with
# extra things in `state` that should have only been in the
# `timeline`.
if event.is_state():
timeline_state[(event.type, event.state_key)] = event.event_id

# When using `state_after`, there is no special treatment with
# regards to state also being in the `timeline`. Always fetch
# relevant membership regardless of whether the state event is in
Expand All @@ -1061,9 +1068,6 @@ async def compute_state_delta(
members_to_fetch.add(event.sender)
# FIXME: we also care about invite targets etc.

if event.is_state():
timeline_state[(event.type, event.state_key)] = event.event_id

else:
timeline_state = {
(event.type, event.state_key): event.event_id
Expand Down
Loading