Tweak removeDuplicates calls to use events instead of recentEvents (#2853)

... since `events` is *after* history visibility filtering, not before
it.
This commit is contained in:
Neil Alexander 2022-11-03 10:19:37 +00:00 committed by GitHub
parent 1fcbb9b5e5
commit 8704e84898
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -316,7 +316,7 @@ func (p *PDUStreamProvider) addRoomDeltaToResponse(
// left. Anything that appears in the filtered timeline will be removed from the // left. Anything that appears in the filtered timeline will be removed from the
// "state" section and kept in "timeline". // "state" section and kept in "timeline".
delta.StateEvents = gomatrixserverlib.HeaderedReverseTopologicalOrdering( delta.StateEvents = gomatrixserverlib.HeaderedReverseTopologicalOrdering(
removeDuplicates(delta.StateEvents, recentEvents), removeDuplicates(delta.StateEvents, events),
gomatrixserverlib.TopologicalOrderByAuthEvents, gomatrixserverlib.TopologicalOrderByAuthEvents,
) )
@ -530,7 +530,7 @@ func (p *PDUStreamProvider) getJoinResponseForCompleteSync(
// If we are limited by the filter AND the history visibility filter // If we are limited by the filter AND the history visibility filter
// didn't "remove" events, return that the response is limited. // didn't "remove" events, return that the response is limited.
limited = limited && len(events) == len(recentEvents) limited = limited && len(events) == len(recentEvents)
stateEvents = removeDuplicates(stateEvents, recentEvents) stateEvents = removeDuplicates(stateEvents, events)
if stateFilter.LazyLoadMembers { if stateFilter.LazyLoadMembers {
if err != nil { if err != nil {
return nil, err return nil, err