From 958ae244b0cd2ed79ccd8f20a834d27ee20c42ca Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 25 Oct 2021 18:46:41 +0200 Subject: [PATCH 1/3] respect "right container request" for jitsi --- src/stores/widgets/WidgetLayoutStore.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/stores/widgets/WidgetLayoutStore.ts b/src/stores/widgets/WidgetLayoutStore.ts index 5d427a0f1a1..182a8003d4e 100644 --- a/src/stores/widgets/WidgetLayoutStore.ts +++ b/src/stores/widgets/WidgetLayoutStore.ts @@ -206,16 +206,16 @@ export class WidgetLayoutStore extends ReadyWatchingStore { const manualContainer = userLayout?.widgets?.[widget.id]?.container; const isLegacyPinned = !!legacyPinned?.[widget.id]; const defaultContainer = WidgetType.JITSI.matches(widget.type) ? Container.Top : Container.Right; - - if (manualContainer === Container.Right) { - rightWidgets.push(widget); - } else if (manualContainer === Container.Top || stateContainer === Container.Top) { - topWidgets.push(widget); - } else if (isLegacyPinned && !stateContainer) { - topWidgets.push(widget); - } else { - (defaultContainer === Container.Top ? topWidgets : rightWidgets).push(widget); + + let targetContainer = defaultContainer; + if(manualContainer !== undefined || stateContainer !== undefined){ + targetContainer = (manualContainer) ? manualContainer : stateContainer; + } + // Special legacy case + else if (isLegacyPinned && !stateContainer) { + targetContainer = Container.Top; } + (targetContainer === Container.Top ? topWidgets : rightWidgets).push(widget); } // Trim to MAX_PINNED @@ -423,7 +423,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore { public moveToContainer(room: Room, widget: IApp, toContainer: Container) { const allWidgets = this.getAllWidgets(room); - if (!allWidgets.some(([w])=> w.id === widget.id)) return; // invalid + if (!allWidgets.some(([w]) => w.id === widget.id)) return; // invalid this.updateUserLayout(room, { [widget.id]: { container: toContainer }, }); From 07d8d61ca2db9abe5811d421b0559893a6797916 Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 26 Oct 2021 12:28:50 +0200 Subject: [PATCH 2/3] linter fixes and check for truthiness --- src/stores/widgets/WidgetLayoutStore.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stores/widgets/WidgetLayoutStore.ts b/src/stores/widgets/WidgetLayoutStore.ts index 182a8003d4e..75833e28a48 100644 --- a/src/stores/widgets/WidgetLayoutStore.ts +++ b/src/stores/widgets/WidgetLayoutStore.ts @@ -206,11 +206,11 @@ export class WidgetLayoutStore extends ReadyWatchingStore { const manualContainer = userLayout?.widgets?.[widget.id]?.container; const isLegacyPinned = !!legacyPinned?.[widget.id]; const defaultContainer = WidgetType.JITSI.matches(widget.type) ? Container.Top : Container.Right; - + let targetContainer = defaultContainer; - if(manualContainer !== undefined || stateContainer !== undefined){ + if (!!manualContainer || !!stateContainer) { targetContainer = (manualContainer) ? manualContainer : stateContainer; - } + } // Special legacy case else if (isLegacyPinned && !stateContainer) { targetContainer = Container.Top; From 90618e197f3fa83d6767004e7d2e1a9c74ab944a Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 26 Oct 2021 13:37:19 +0200 Subject: [PATCH 3/3] fix remaining linter issues --- src/stores/widgets/WidgetLayoutStore.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/stores/widgets/WidgetLayoutStore.ts b/src/stores/widgets/WidgetLayoutStore.ts index 75833e28a48..7efc5fb195b 100644 --- a/src/stores/widgets/WidgetLayoutStore.ts +++ b/src/stores/widgets/WidgetLayoutStore.ts @@ -210,9 +210,8 @@ export class WidgetLayoutStore extends ReadyWatchingStore { let targetContainer = defaultContainer; if (!!manualContainer || !!stateContainer) { targetContainer = (manualContainer) ? manualContainer : stateContainer; - } - // Special legacy case - else if (isLegacyPinned && !stateContainer) { + } else if (isLegacyPinned && !stateContainer) { + // Special legacy case targetContainer = Container.Top; } (targetContainer === Container.Top ? topWidgets : rightWidgets).push(widget);