Merge pull request #4177 from matrix-org/travis/no-rooms-dm

Fix not being able to start chats when you have no rooms
This commit is contained in:
Travis Ralston 2020-03-04 15:35:27 -07:00 committed by GitHub
commit d3439c8101
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -168,6 +168,7 @@ export default class DMRoomMap {
}
getUniqueRoomsWithIndividuals(): {[userId: string]: Room} {
if (!this.roomToUser) return {}; // No rooms means no map.
return Object.keys(this.roomToUser)
.map(r => ({userId: this.getUserIdForRoomId(r), room: this.matrixClient.getRoom(r)}))
.filter(r => r.userId && r.room && r.room.getInvitedAndJoinedMemberCount() === 2)