Merge pull request #465 from matrix-org/dbkr/fix_unset_dm

Fix un-marking rooms as DM  rooms
pull/21833/head
Matthew Hodgson 2016-09-13 13:08:31 +01:00 committed by GitHub
commit ed2595e300
1 changed files with 6 additions and 4 deletions

View File

@ -107,11 +107,13 @@ export function setDMRoom(roomId, userId) {
}
// now add it, if it's not already there
const roomList = dmRoomMap[userId] || [];
if (roomList.indexOf(roomId) == -1) {
roomList.push(roomId);
if (userId) {
const roomList = dmRoomMap[userId] || [];
if (roomList.indexOf(roomId) == -1) {
roomList.push(roomId);
}
dmRoomMap[userId] = roomList;
}
dmRoomMap[userId] = roomList;
return MatrixClientPeg.get().setAccountData('m.direct', dmRoomMap);