1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-08 19:08:34 +03:00

fix lint, actually get members as well

This commit is contained in:
Bruno Windels
2018-08-30 11:41:35 +02:00
parent c335a6b3de
commit 3659e86d57

View File

@@ -286,8 +286,6 @@ Room.prototype.getDMInviter = function() {
} }
}; };
/** /**
* Assuming this room is a DM room, tries to guess with which user. * Assuming this room is a DM room, tries to guess with which user.
* @return {string} user id of the other member, if found, otherwise undefined. * @return {string} user id of the other member, if found, otherwise undefined.
@@ -311,6 +309,7 @@ Room.prototype.guessDMUserId = function() {
if (this._summaryHeroes.length) { if (this._summaryHeroes.length) {
return this._summaryHeroes[0]; return this._summaryHeroes[0];
} }
const members = this.currentState.getMembers();
const anyMember = members.filter((m) => m.userId !== this.myUserId); const anyMember = members.filter((m) => m.userId !== this.myUserId);
if (anyMember) { if (anyMember) {
return anyMember; return anyMember;
@@ -335,11 +334,11 @@ Room.prototype.getAvatarFallbackMember = function() {
// as this includes left members // as this includes left members
if (members.length <= 2) { if (members.length <= 2) {
return members.find((m) => { return members.find((m) => {
return m.userId !== this.myUserId return m.userId !== this.myUserId;
}); });
} }
} }
} };
/** /**
* Sets the membership this room was received as during sync * Sets the membership this room was received as during sync