From 10017522e2556d85018b3a9ebaa165dd39916c0b Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 19 Dec 2016 17:59:13 +0000 Subject: [PATCH] Use correct 1-1 room avatar after users leave The correct 1-1 avatar is used with rooms in which there are only two users with either "join" or "invite" as their membership (importantly, not "leave" or otherwise). (This is important when a user moves accounts and re-joins previously left 1-1 chats) --- src/components/views/avatars/RoomAvatar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/avatars/RoomAvatar.js b/src/components/views/avatars/RoomAvatar.js index dcb25eff61..2bb6caddb7 100644 --- a/src/components/views/avatars/RoomAvatar.js +++ b/src/components/views/avatars/RoomAvatar.js @@ -86,7 +86,7 @@ module.exports = React.createClass({ var userIds = []; // for .. in optimisation to return early if there are >2 keys for (var uid in mlist) { - if (mlist.hasOwnProperty(uid)) { + if (mlist.hasOwnProperty(uid) && ["join", "invite"].includes(mlist[uid].membership)) { userIds.push(uid); } if (userIds.length > 2) {