1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

if we are the only person in a room, call it an 'Empty room' too, given this is how humans see a room if they're the only person in it...

This commit is contained in:
Matthew Hodgson
2016-01-20 23:54:53 +00:00
parent a0d81fccdb
commit eaf7b03bb1

View File

@@ -711,7 +711,7 @@ function calculateRoomName(room, userId, ignoreRoomNameEvent) {
return (m.membership !== "leave"); return (m.membership !== "leave");
}); });
if (memberList.length === 1) { if (memberList.length === 1) {
// we exist, but no one else... self-chat or invite. // self-chat, peeked room with 1 participant, or invite.
if (memberList[0].membership === "invite") { if (memberList[0].membership === "invite") {
if (memberList[0].events.member) { if (memberList[0].events.member) {
// extract who invited us to the room // extract who invited us to the room
@@ -721,10 +721,15 @@ function calculateRoomName(room, userId, ignoreRoomNameEvent) {
return "Room Invite"; return "Room Invite";
} }
} }
else {
if (memberList[0].userId === userId) {
return "Empty room"
}
else { else {
return memberList[0].name; return memberList[0].name;
} }
} }
}
else { else {
// there really isn't anyone in this room... // there really isn't anyone in this room...
return "Empty room"; return "Empty room";