Skip to content

Commit

Permalink
Fix name of 1:1s other person has left (#602)
Browse files Browse the repository at this point in the history
Use their name as we did before rather than 'Empty Room'

Fixes element-hq/element-web#6083
  • Loading branch information
dbkr authored and lukebarnard1 committed Feb 6, 2018
1 parent 47dfb4b commit 032b7ca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/models/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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";
}
Expand Down

0 comments on commit 032b7ca

Please sign in to comment.