fixup: don't consider left DM rooms

pull/21833/head
Bruno Windels 2019-11-12 17:33:24 +01:00
parent 0a2255ce73
commit 8dd7d8e5c0
2 changed files with 7 additions and 3 deletions

View File

@ -190,7 +190,10 @@ function openDMForUser(cli, userId) {
const dmRooms = DMRoomMap.shared().getDMRoomsForUserId(userId);
const lastActiveRoom = dmRooms.reduce((lastActiveRoom, roomId) => {
const room = cli.getRoom(roomId);
if (!lastActiveRoom || (room && lastActiveRoom.getLastActiveTimestamp() < room.getLastActiveTimestamp())) {
if (!room || room.getMyMembership() === "leave") {
return lastActiveRoom;
}
if (!lastActiveRoom || lastActiveRoom.getLastActiveTimestamp() < room.getLastActiveTimestamp()) {
return room;
}
return lastActiveRoom;
@ -317,7 +320,7 @@ const UserOptionsSection = withLegacyMatrixClient(({matrixClient: cli, member, i
return (
<div className="mx_UserInfo_container">
<h3>{ _t("User Options") }</h3>
<h3>{ _t("Options") }</h3>
<div className="mx_UserInfo_buttons">
{ directMessageButton }
{ readReceiptButton }

View File

@ -1068,6 +1068,8 @@
"Files": "Files",
"Trust & Devices": "Trust & Devices",
"Direct messages": "Direct messages",
"Direct message": "Direct message",
"Options": "Options",
"Remove from community": "Remove from community",
"Disinvite this user from community?": "Disinvite this user from community?",
"Remove this user from community?": "Remove this user from community?",
@ -1091,7 +1093,6 @@
"Reply": "Reply",
"Edit": "Edit",
"Message Actions": "Message Actions",
"Options": "Options",
"Attachment": "Attachment",
"Error decrypting attachment": "Error decrypting attachment",
"Decrypt %(text)s": "Decrypt %(text)s",