Merge pull request #5487 from matrix-org/travis/pinning

Fix being unable to pin widgets
pull/21833/head
Travis Ralston 2020-12-11 21:52:11 -07:00 committed by GitHub
commit 33c2ba53fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -134,6 +134,7 @@ export default class WidgetStore extends AsyncStoreWithClient<IState> {
// first clean out old widgets from the map which originate from this room
// otherwise we are out of sync with the rest of the app with stale widget events during removal
Array.from(this.widgetMap.values()).forEach(app => {
if (app.roomId !== room.roomId) return; // skip - wrong room
this.widgetMap.delete(widgetUid(app));
});
@ -233,7 +234,7 @@ export default class WidgetStore extends AsyncStoreWithClient<IState> {
// Clean up the pinned record
Object.keys(roomInfo).forEach(wId => {
if (!roomInfo.widgets.some(w => w.id === wId)) {
if (!roomInfo.widgets.some(w => w.id === wId) || !roomInfo.pinned[wId]) {
delete roomInfo.pinned[wId];
}
});