From 582963ab91a6a18ceaff8175beac1c508ac3eb00 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 4 Mar 2024 17:53:23 +0100 Subject: [PATCH] fix: Do not compare timestamps when setting roomstate We now handle state in the correct order in the sync handler. Using the timestamp lead to false results when we still generated a default timestamp of "now" for events, however even without that state events can have an older timestamp like when accepting an invite on a server with the clock behind by a minute and we should instead rely on the sync handler giving us state in the right order. --- lib/src/room.dart | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/src/room.dart b/lib/src/room.dart index f330b72a..2a619a91 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -196,15 +196,6 @@ class Room { return; } - // Do not set old events as state events - final prevEvent = getState(state.type, stateKey); - if (prevEvent != null && - prevEvent.eventId != state.eventId && - prevEvent.originServerTs.millisecondsSinceEpoch > - state.originServerTs.millisecondsSinceEpoch) { - return; - } - (states[state.type] ??= {})[stateKey] = state; client.onRoomState.add(state);