1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-04 05:02:41 +03:00

also clear out lazy loaded members from storage

This commit is contained in:
Bruno Windels
2018-08-31 16:11:37 +02:00
parent 7258fe4e5c
commit 9b1926f902
2 changed files with 17 additions and 0 deletions

View File

@@ -443,6 +443,22 @@ RoomState.prototype.markOutOfBandMembersFailed = function() {
this._oobMemberFlags.status = OOB_STATUS_NOTSTARTED;
};
/**
* Clears the loaded out-of-band members
*/
RoomState.prototype.clearOutOfBandMembers = function() {
let count = 0;
Object.keys(this.members).forEach((userId) => {
const member = this.members[userId];
if (member.isOutOfBand()) {
++count;
delete this.members[userId];
}
});
console.log(`LL: RoomState removed ${count} members...`);
this._oobMemberFlags.status = OOB_STATUS_NOTSTARTED;
};
/**
* Sets the loaded out-of-band members.
* @param {MatrixEvent[]} stateEvents array of membership state events

View File

@@ -465,6 +465,7 @@ Room.prototype.clearLoadedMembersIfNeeded = async function() {
await this.loadMembersIfNeeded();
this._membersPromise = null;
await this._client.store.clearOutOfBandMembers(this.roomId);
this.currentState.clearOutOfBandMembers();
}
};