Skip to content

Commit

Permalink
replace getMember(myId).membership with getMyMembership
Browse files Browse the repository at this point in the history
This works with rooms which haven't had their members
loaded yet.
  • Loading branch information
bwindels committed Aug 15, 2018
1 parent c0f706a commit f55a207
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 3 additions & 3 deletions examples/node/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ function printRoomList() {
dateStr = new Date(msg.getTs()).toISOString().replace(
/T/, ' ').replace(/\..+/, '');
}
var me = roomList[i].getMember(myUserId);
if (me) {
fmt = fmts[me.membership];
var myMembership = roomList[i].getMyMembership();
if (myMembership) {
fmt = fmts[myMembership];
}
var roomName = fixWidth(roomList[i].name, 25);
print(
Expand Down
10 changes: 2 additions & 8 deletions src/crypto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1008,14 +1008,8 @@ Crypto.prototype._getE2eRooms = function() {
}

// ignore any rooms which we have left
const me = room.getMember(this._userId);
if (!me || (
me.membership !== "join" && me.membership !== "invite"
)) {
return false;
}

return true;
const myMembership = room.getMyMembership();
return myMembership === "join" || myMembership === "invite";
});
};

Expand Down

0 comments on commit f55a207

Please sign in to comment.