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

View File

@@ -202,7 +202,7 @@ LocalIndexedDBStoreBackend.prototype = {
* Returns the out-of-band membership events for this room that * Returns the out-of-band membership events for this room that
* were previously loaded. * were previously loaded.
* @param {string} roomId * @param {string} roomId
* @returns {event[]} the events, potentially an empty array if OOB loading didn't yield any new members * @returns {Promise<event[]>} the events, potentially an empty array if OOB loading didn't yield any new members
* @returns {null} in case the members for this room haven't been stored yet * @returns {null} in case the members for this room haven't been stored yet
*/ */
getOutOfBandMembers: function(roomId) { getOutOfBandMembers: function(roomId) {