also sync room not in the rooms section but with new room keys

This commit is contained in:
Bruno Windels 2021-03-01 22:30:45 +01:00
parent 8d080163b3
commit 10003e7d3a

View file

@ -257,6 +257,20 @@ export class Sync {
response, sessionState.lock, prepareTxn, log));
const newKeysByRoom = sessionState.preparation?.newKeysByRoom;
// add any rooms with new keys but no sync response to the list of rooms to be synced
if (newKeysByRoom) {
const {hasOwnProperty} = Object.prototype;
for (const roomId of newKeysByRoom.keys()) {
const isRoomInResponse = response.rooms?.join && hasOwnProperty.call(response.rooms.join, roomId);
if (!isRoomInResponse) {
let room = this._session.rooms.get(roomId);
if (room) {
roomStates.push(new RoomSyncProcessState(room, {}, room.membership));
}
}
}
}
await Promise.all(roomStates.map(async rs => {
const newKeys = newKeysByRoom?.get(rs.room.id);