create user id array in m.direct if it doesn't exist already

This commit is contained in:
Bruno Windels 2022-02-10 19:59:44 +01:00
parent d2008a336b
commit 2765f48a64

View file

@ -236,7 +236,10 @@ export class RoomBeingCreated extends EventEmitter<{change: never}> {
mapEntry = {type: DM_MAP_TYPE, content: {}};
}
const map = mapEntry.content;
const userRooms = map[userId];
let userRooms = map[userId];
if (!userRooms) {
map[userId] = userRooms = [];
}
// this is a new room id so no need to check if it's already there
userRooms.push(this._roomId);
txn.accountData.set(mapEntry);