mirror of https://github.com/vector-im/riot-web
Merge pull request #1575 from matrix-org/luke/fix-flair-store-again
Fix Flair not appearing due to missing this._usersInFlightpull/21833/head
commit
d4adff3d25
|
@ -48,6 +48,9 @@ class FlairStore extends EventEmitter {
|
|||
// reject: () => {}
|
||||
// }
|
||||
};
|
||||
this._usersInFlight = {
|
||||
// This has the same schema as _usersPending
|
||||
};
|
||||
|
||||
this._debounceTimeoutID = null;
|
||||
}
|
||||
|
@ -125,12 +128,16 @@ class FlairStore extends EventEmitter {
|
|||
} catch (err) {
|
||||
// Propagate the same error to all usersInFlight
|
||||
Object.keys(this._usersInFlight).forEach((userId) => {
|
||||
// The promise should always exist for userId, but do a null-check anyway
|
||||
if (!this._usersInFlight[userId]) return;
|
||||
this._usersInFlight[userId].reject(err);
|
||||
});
|
||||
return;
|
||||
}
|
||||
const updatedUserGroups = resp.users;
|
||||
Object.keys(this._usersInFlight).forEach((userId) => {
|
||||
// The promise should always exist for userId, but do a null-check anyway
|
||||
if (!this._usersInFlight[userId]) return;
|
||||
this._usersInFlight[userId].resolve(updatedUserGroups[userId] || []);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue