Use FlairStore's cache for group naming
Turns out GroupStore doesn't really know much.
This commit is contained in:
parent
e68c4efd0b
commit
90d9d7128d
5 changed files with 34 additions and 10 deletions
|
@ -148,6 +148,22 @@ class FlairStore extends EventEmitter {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile for the given group if known, otherwise returns null.
|
||||
* This triggers `getGroupProfileCached` if needed, though the result of the
|
||||
* call will not be returned by this function.
|
||||
* @param matrixClient The matrix client to use to fetch the profile, if needed.
|
||||
* @param groupId The group ID to get the profile for.
|
||||
* @returns The profile if known, otherwise null.
|
||||
*/
|
||||
getGroupProfileCachedFast(matrixClient, groupId) {
|
||||
if (this._groupProfiles[groupId]) {
|
||||
return this._groupProfiles[groupId];
|
||||
}
|
||||
this.getGroupProfileCached(matrixClient, groupId);
|
||||
return null;
|
||||
}
|
||||
|
||||
async getGroupProfileCached(matrixClient, groupId) {
|
||||
if (this._groupProfiles[groupId]) {
|
||||
return this._groupProfiles[groupId];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue