1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

PR feedback

This commit is contained in:
Bruno Windels
2018-08-03 13:54:28 +02:00
parent 01d8730850
commit 0fa49bc2cd
2 changed files with 8 additions and 8 deletions

View File

@@ -795,17 +795,17 @@ MatrixClient.prototype.loadRoomMembersIfNeeded = async function(roomId) {
if (!room || !room.needsOutOfBandMembers()) {
return;
}
// intercept whether we need to store oob members afterwards
let membersNeedStoring = false;
// Note that we don't await _loadMembers here first.
// setLazyLoadedMembers sets a flag before it awaits the promise passed in
// to avoid a race when calling membersNeedLoading/loadOutOfBandMembers
// in fast succession, before the first promise resolves.
let membersPromise = this._loadMembers(room);
// intercept whether we need to store oob members afterwards
let membersNeedStoring = false;
membersPromise = membersPromise.then(({memberEvents, fromServer}) => {
membersNeedStoring = fromServer;
return memberEvents;
});
const membersPromise = this._loadMembers(room)
.then(({memberEvents, fromServer}) => {
membersNeedStoring = fromServer;
return memberEvents;
});
await room.loadOutOfBandMembers(membersPromise);
// if loadOutOfBandMembers throws, this wont be called
// but that's fine as we don't want to store members