aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-10-22 11:50:48 +0100
committerGitHub <noreply@github.com>2020-10-22 11:50:48 +0100
commitf32320a2355b960e45d42c5cbe7cfea820873767 (patch)
treee8c0a1fca125f0b1bf81da31de3706c6189165b9
parent3afc623098dc2cc24093466f69e1d9c4bac9d35b (diff)
Exclude old state events from sync when consumed from roomserver (#1548)
* Exclude old room events from sync when consumed from roomserver * Fix comment * Experimental hack
-rw-r--r--syncapi/consumers/roomserver.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/syncapi/consumers/roomserver.go b/syncapi/consumers/roomserver.go
index 593bfc5c..ac1128c1 100644
--- a/syncapi/consumers/roomserver.go
+++ b/syncapi/consumers/roomserver.go
@@ -189,14 +189,20 @@ 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
- false, // not excluded from sync
+ []string{}, // adds no state
+ []string{}, // removes no state
+ nil, // no transaction
+ ev.StateKey() != nil, // exclude from sync?
)
if err != nil {
// panic rather than continue with an inconsistent database