You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-07 10:46:24 +03:00
Don't crash if no DM rooms with someone
...when opening MemberInfo. getDMRoomsForUserId should always return a valid list, since it's a list of what DM rooms you have with somebody.
This commit is contained in:
@@ -37,10 +37,14 @@ 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) {
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user