fix: archived room state store logic
This was implicitly relying to the timestamp of state events getting compared in the setState function. Fix this by using the helper functions already used for invite and join rooms.
This commit is contained in:
parent
69fe7845a9
commit
f6fa9df2c5
|
|
@ -1071,19 +1071,19 @@ class Client extends MatrixApi {
|
||||||
[]));
|
[]));
|
||||||
|
|
||||||
archivedRoom.prev_batch = update.timeline?.prevBatch;
|
archivedRoom.prev_batch = update.timeline?.prevBatch;
|
||||||
update.state?.forEach((event) {
|
|
||||||
archivedRoom.setState(Event.fromMatrixEvent(
|
|
||||||
event,
|
|
||||||
archivedRoom,
|
|
||||||
));
|
|
||||||
});
|
|
||||||
|
|
||||||
update.timeline?.events?.forEach((event) {
|
final stateEvents = roomUpdate.state;
|
||||||
archivedRoom.setState(Event.fromMatrixEvent(
|
if (stateEvents != null) {
|
||||||
event,
|
await _handleRoomEvents(archivedRoom, stateEvents, EventUpdateType.state,
|
||||||
archivedRoom,
|
store: false);
|
||||||
));
|
}
|
||||||
});
|
|
||||||
|
final timelineEvents = roomUpdate.timeline?.events;
|
||||||
|
if (timelineEvents != null) {
|
||||||
|
await _handleRoomEvents(archivedRoom, timelineEvents.reversed.toList(),
|
||||||
|
EventUpdateType.timeline,
|
||||||
|
store: false);
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < timeline.events.length; i++) {
|
for (var i = 0; i < timeline.events.length; i++) {
|
||||||
// Try to decrypt encrypted events but don't update the database.
|
// Try to decrypt encrypted events but don't update the database.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue