From 2b9c2daaf4e7432fab708ce3ec670d2b45fa26ad Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 20 Oct 2020 16:07:21 +0100 Subject: [PATCH] Fix auto-pinned widget ordering Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/stores/WidgetStore.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/stores/WidgetStore.ts b/src/stores/WidgetStore.ts index 6bdea9f2f1..952cd49606 100644 --- a/src/stores/WidgetStore.ts +++ b/src/stores/WidgetStore.ts @@ -168,6 +168,16 @@ export default class WidgetStore extends AsyncStoreWithClient { } public pinWidget(widgetId: string) { + const roomId = this.getRoomId(widgetId); + const roomInfo = this.getRoom(roomId); + if (!roomInfo) return; + + // When pinning, first confirm all the widgets (Jitsi) which were autopinned so that the order is correct + const autoPinned = this.getPinnedApps(roomId).filter(app => !roomInfo.pinned[app.id]); + autoPinned.forEach(app => { + this.setPinned(app.id, true); + }); + this.setPinned(widgetId, true); // Show the apps drawer upon the user pinning a widget