From d27c4a0874dabb77c2eda6b23eb7c00478bc9e90 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 16 Aug 2022 13:37:24 +0100 Subject: [PATCH] Don't dedupe before applying the history vis filter --- syncapi/streams/stream_pdu.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/syncapi/streams/stream_pdu.go b/syncapi/streams/stream_pdu.go index dc625c749..9f9641c1a 100644 --- a/syncapi/streams/stream_pdu.go +++ b/syncapi/streams/stream_pdu.go @@ -498,7 +498,6 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync( // transaction IDs for complete syncs, but we do it anyway because Sytest demands it for: // "Can sync a room with a message with a transaction id" - which does a complete sync to check. recentEvents := p.DB.StreamEventsToEvents(device, recentStreamEvents) - stateEvents = removeDuplicates(stateEvents, recentEvents) events := recentEvents // Only apply history visibility checks if the response is for joined rooms @@ -509,6 +508,8 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync( } } + stateEvents = removeDuplicates(stateEvents, recentEvents) + // 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)