fix: requestHistory() for archived rooms

Using JoinedRoomUpdate() in a fake
sync for archived rooms when requesting
the history leads to the problem that
the room is stored as a joined room
in the store which is wrong.
This commit is contained in:
Christian Pauly 2021-08-25 10:37:01 +02:00
parent 2f35277e47
commit e1343e9c83
1 changed files with 16 additions and 6 deletions

View File

@ -959,12 +959,22 @@ class Room {
await client.handleSync( await client.handleSync(
SyncUpdate(nextBatch: '') SyncUpdate(nextBatch: '')
..rooms = (RoomsUpdate() ..rooms = (RoomsUpdate()
..join = ({}..[id] = (JoinedRoomUpdate() ..join = membership == Membership.join
..state = resp.state ? ({}..[id] = ((JoinedRoomUpdate()
..timeline = (TimelineUpdate() ..state = resp.state
..limited = false ..timeline = (TimelineUpdate()
..events = resp.chunk ..limited = false
..prevBatch = resp.end)))), ..events = resp.chunk
..prevBatch = resp.end))))
: null
..leave = membership != Membership.join
? ({}..[id] = ((LeftRoomUpdate()
..state = resp.state
..timeline = (TimelineUpdate()
..limited = false
..events = resp.chunk
..prevBatch = resp.end))))
: null),
sortAtTheEnd: true); sortAtTheEnd: true);
}; };