diff --git a/src/matrix/e2ee/RoomEncryption.js b/src/matrix/e2ee/RoomEncryption.js index 190852d3..d179c23f 100644 --- a/src/matrix/e2ee/RoomEncryption.js +++ b/src/matrix/e2ee/RoomEncryption.js @@ -45,8 +45,11 @@ export class RoomEncryption { } async writeMemberChanges(memberChanges, txn) { - if (memberChanges.some(m => m.hasLeft)) { - this._megolmEncryption.discardOutboundSession(this._room.id, txn); + for (const m of memberChanges.values()) { + if (m.hasLeft) { + this._megolmEncryption.discardOutboundSession(this._room.id, txn); + break; + } } return await this._deviceTracker.writeMemberChanges(this._room, memberChanges, txn); }