From 4d10a8fb1807b3ab742e17a562bcae377057be50 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 8 Apr 2024 14:55:19 +0100 Subject: [PATCH] Fixups to #17064 (#17065) Forget a line, and an empty batch is trivially linear. c.f. #17064 --- changelog.d/17065.bugfix | 1 + synapse/handlers/sync.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 changelog.d/17065.bugfix diff --git a/changelog.d/17065.bugfix b/changelog.d/17065.bugfix new file mode 100644 index 000000000..99ed435d7 --- /dev/null +++ b/changelog.d/17065.bugfix @@ -0,0 +1 @@ +Fix various long-standing bugs which could cause incorrect state to be returned from `/sync` in certain situations. diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index 7c29c1554..410805e80 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -1272,8 +1272,11 @@ class SyncHandler: for e in batch.events[1:]: if e.prev_event_ids() != [prev_event_id]: break + prev_event_id = e.event_id else: is_linear_timeline = True + else: + is_linear_timeline = True if is_linear_timeline and not batch.limited: state_ids: StateMap[str] = {}