Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 82c2102

Browse files
authored
Respect the roomState right container request for the Jitsi widget (#7033)
1 parent a4e20c7 commit 82c2102

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/stores/widgets/WidgetLayoutStore.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,14 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
207207
const isLegacyPinned = !!legacyPinned?.[widget.id];
208208
const defaultContainer = WidgetType.JITSI.matches(widget.type) ? Container.Top : Container.Right;
209209

210-
if (manualContainer === Container.Right) {
211-
rightWidgets.push(widget);
212-
} else if (manualContainer === Container.Top || stateContainer === Container.Top) {
213-
topWidgets.push(widget);
210+
let targetContainer = defaultContainer;
211+
if (!!manualContainer || !!stateContainer) {
212+
targetContainer = (manualContainer) ? manualContainer : stateContainer;
214213
} else if (isLegacyPinned && !stateContainer) {
215-
topWidgets.push(widget);
216-
} else {
217-
(defaultContainer === Container.Top ? topWidgets : rightWidgets).push(widget);
214+
// Special legacy case
215+
targetContainer = Container.Top;
218216
}
217+
(targetContainer === Container.Top ? topWidgets : rightWidgets).push(widget);
219218
}
220219

221220
// Trim to MAX_PINNED
@@ -423,7 +422,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
423422

424423
public moveToContainer(room: Room, widget: IApp, toContainer: Container) {
425424
const allWidgets = this.getAllWidgets(room);
426-
if (!allWidgets.some(([w])=> w.id === widget.id)) return; // invalid
425+
if (!allWidgets.some(([w]) => w.id === widget.id)) return; // invalid
427426
this.updateUserLayout(room, {
428427
[widget.id]: { container: toContainer },
429428
});

0 commit comments

Comments
 (0)