mirror of https://github.com/vector-im/riot-web
Merge pull request #457 from matrix-org/dbkr/dont_crash_if_no_dm_rooms
Don't crash if no DM rooms with someonepull/21833/head
commit
8160613e01
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue