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)
This commit is contained in:
Luke Barnard 2016-12-19 17:59:13 +00:00
parent 70c7facb6f
commit 10017522e2

View file

@ -86,7 +86,7 @@ module.exports = React.createClass({
var userIds = []; var userIds = [];
// for .. in optimisation to return early if there are >2 keys // for .. in optimisation to return early if there are >2 keys
for (var uid in mlist) { for (var uid in mlist) {
if (mlist.hasOwnProperty(uid)) { if (mlist.hasOwnProperty(uid) && ["join", "invite"].includes(mlist[uid].membership)) {
userIds.push(uid); userIds.push(uid);
} }
if (userIds.length > 2) { if (userIds.length > 2) {