From 032b7cab5d7c9d2f02d3e7f8b6ebefaf4fdca191 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 6 Feb 2018 15:43:53 +0000 Subject: [PATCH] Fix name of 1:1s other person has left (#602) Use their name as we did before rather than 'Empty Room' Fixes https://github.com/vector-im/riot-web/issues/6083 --- src/models/room.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/models/room.js b/src/models/room.js index f061b1bf841..81913e93e35 100644 --- a/src/models/room.js +++ b/src/models/room.js @@ -1220,6 +1220,9 @@ function calculateRoomName(room, userId, ignoreRoomNameEvent) { if (otherMembers.length === 0) { + const leftMembers = utils.filter(room.currentState.getMembers(), function(m) { + return m.userId !== userId && m.membership === "leave"; + }); if (allMembers.length === 1) { // self-chat, peeked room with 1 participant, // or inbound invite, or outbound 3PID invite. @@ -1239,6 +1242,10 @@ function calculateRoomName(room, userId, ignoreRoomNameEvent) { } } return name; + } else if (leftMembers.length === 1) { + // if it was a chat with one person who's now left, it's still + // notionally a chat with them + return leftMembers[0].name; } else { return "Empty room"; }