Merge pull request #2077 from matrix-org/bwindels/fix-dm-error-on-left-room

FIX: Don't error on rooms the user has left already
This commit is contained in:
David Baker 2018-07-23 17:24:41 +01:00 committed by GitHub
commit d242935a90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -191,14 +191,11 @@ function _showAnyInviteErrors(addrs, room) {
function _getDirectMessageRooms(addr) {
const dmRoomMap = new DMRoomMap(MatrixClientPeg.get());
const dmRooms = dmRoomMap.getDMRoomsForUserId(addr);
const rooms = [];
dmRooms.forEach((dmRoom) => {
const rooms = dmRooms.filter((dmRoom) => {
const room = MatrixClientPeg.get().getRoom(dmRoom);
if (room) {
const me = room.getMember(MatrixClientPeg.get().credentials.userId);
if (me.membership == 'join') {
rooms.push(room);
}
return me && me.membership == 'join';
}
});
return rooms;