diff --git a/src/utils/DMRoomMap.js b/src/utils/DMRoomMap.js index 0089ebbe5b..3bcc492a9f 100644 --- a/src/utils/DMRoomMap.js +++ b/src/utils/DMRoomMap.js @@ -32,7 +32,9 @@ export default class DMRoomMap { } getDMRoomsForUserId(userId) { - return this.userToRooms[userId]; + // Here, we return the empty list if there are no rooms, + // since the number of conversations you have with this user is zero. + return this.userToRooms[userId] || []; } getUserIdForRoomId(roomId) { @@ -45,6 +47,8 @@ export default class DMRoomMap { // is never called. this._populateRoomToUser(); } + // Here, we return undefined if the room is not in the map: + // the room ID you gave is not a DM room for any user. return this.roomToUser[roomId]; }