From 7f8d9986feedd83bce75c4aebde70968f43d63f7 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 12 Sep 2022 16:07:45 +0100 Subject: [PATCH] Exclude `KindOld` from sync --- syncapi/consumers/roomserver.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go index 6979eb484..e011b92b7 100644 --- a/syncapi/consumers/roomserver.go +++ b/syncapi/consumers/roomserver.go @@ -278,20 +278,14 @@ func (s *OutputRoomEventConsumer) onOldRoomEvent( ) error { ev := msg.Event - // TODO: The state key check when excluding from sync is designed - // to stop us from lying to clients with old state, whilst still - // allowing normal timeline events through. This is an absolute - // hack but until we have some better strategy for dealing with - // old events in the sync API, this should at least prevent us - // from confusing clients into thinking they've joined/left rooms. pduPos, err := s.db.WriteEvent( ctx, ev, []*gomatrixserverlib.HeaderedEvent{}, - []string{}, // adds no state - []string{}, // removes no state - nil, // no transaction - ev.StateKey() != nil, // exclude from sync?, + []string{}, // adds no state + []string{}, // removes no state + nil, // no transaction + true, // exclude from sync msg.HistoryVisibility, ) if err != nil {