From 8704e84898e2a31d5cefbdb43c8d7b325f20eb51 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 3 Nov 2022 10:19:37 +0000 Subject: [PATCH] Tweak `removeDuplicates` calls to use `events` instead of `recentEvents` (#2853) ... since `events` is *after* history visibility filtering, not before it. --- syncapi/streams/stream_pdu.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syncapi/streams/stream_pdu.go b/syncapi/streams/stream_pdu.go index 5ea2732f4..5b3560810 100644 --- a/syncapi/streams/stream_pdu.go +++ b/syncapi/streams/stream_pdu.go @@ -316,7 +316,7 @@ func (p *PDUStreamProvider) addRoomDeltaToResponse( // left. Anything that appears in the filtered timeline will be removed from the // "state" section and kept in "timeline". delta.StateEvents = gomatrixserverlib.HeaderedReverseTopologicalOrdering( - removeDuplicates(delta.StateEvents, recentEvents), + removeDuplicates(delta.StateEvents, events), gomatrixserverlib.TopologicalOrderByAuthEvents, ) @@ -530,7 +530,7 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync( // If we are limited by the filter AND the history visibility filter // didn't "remove" events, return that the response is limited. limited = limited && len(events) == len(recentEvents) - stateEvents = removeDuplicates(stateEvents, recentEvents) + stateEvents = removeDuplicates(stateEvents, events) if stateFilter.LazyLoadMembers { if err != nil { return nil, err