mirror of https://github.com/vector-im/riot-web
Invalidate the user's public groups cache when changing group publicity
This will make the changes to their Flair "live", but only from the user's own perspective.pull/21833/head
parent
03f4e6c622
commit
0ff5b9c6a7
|
@ -56,6 +56,10 @@ class FlairStore extends EventEmitter {
|
||||||
return groupSupport;
|
return groupSupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invalidatePublicisedGroups(userId) {
|
||||||
|
delete this._userGroups[userId];
|
||||||
|
}
|
||||||
|
|
||||||
getPublicisedGroupsCached(matrixClient, userId) {
|
getPublicisedGroupsCached(matrixClient, userId) {
|
||||||
if (this._userGroups[userId]) {
|
if (this._userGroups[userId]) {
|
||||||
return Promise.resolve(this._userGroups[userId]);
|
return Promise.resolve(this._userGroups[userId]);
|
||||||
|
|
|
@ -15,6 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
|
import FlairStore from './FlairStore';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the group summary for a room and provides an API to change it and
|
* Stores the group summary for a room and provides an API to change it and
|
||||||
|
@ -110,6 +111,7 @@ export default class GroupStore extends EventEmitter {
|
||||||
setGroupPublicity(isPublished) {
|
setGroupPublicity(isPublished) {
|
||||||
return this._matrixClient
|
return this._matrixClient
|
||||||
.setGroupPublicity(this.groupId, isPublished)
|
.setGroupPublicity(this.groupId, isPublished)
|
||||||
|
.then(() => { FlairStore.invalidatePublicisedGroups(this._matrixClient.credentials.userId); })
|
||||||
.then(this._fetchSummary.bind(this));
|
.then(this._fetchSummary.bind(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue