mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-08 07:28:26 +00:00
Merge pull request #457 from matrix-org/dbkr/dont_crash_if_no_dm_rooms
Don't crash if no DM rooms with someone
This commit is contained in:
@@ -32,7 +32,9 @@ export default class DMRoomMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getDMRoomsForUserId(userId) {
|
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) {
|
getUserIdForRoomId(roomId) {
|
||||||
@@ -45,6 +47,8 @@ export default class DMRoomMap {
|
|||||||
// is never called.
|
// is never called.
|
||||||
this._populateRoomToUser();
|
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];
|
return this.roomToUser[roomId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user