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.
This commit is contained in:
Nicolas Werner 2024-03-04 17:53:23 +01:00
parent 6f82e92f2c
commit 582963ab91
No known key found for this signature in database
GPG Key ID: B38119FF80087618
1 changed files with 0 additions and 9 deletions

View File

@ -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);