From 2765f48a640f5a5474cb9f71463f3ad33a640d41 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 10 Feb 2022 19:59:44 +0100 Subject: [PATCH] create user id array in m.direct if it doesn't exist already --- src/matrix/room/RoomBeingCreated.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/RoomBeingCreated.ts b/src/matrix/room/RoomBeingCreated.ts index 9e564a87..78202203 100644 --- a/src/matrix/room/RoomBeingCreated.ts +++ b/src/matrix/room/RoomBeingCreated.ts @@ -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);