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

Commit

Permalink
Respect the roomState right container request for the Jitsi widget (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 authored Oct 26, 2021
1 parent a4e20c7 commit 82c2102
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/stores/widgets/WidgetLayoutStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,14 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
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);
let targetContainer = defaultContainer;
if (!!manualContainer || !!stateContainer) {
targetContainer = (manualContainer) ? manualContainer : stateContainer;
} else if (isLegacyPinned && !stateContainer) {
topWidgets.push(widget);
} else {
(defaultContainer === Container.Top ? topWidgets : rightWidgets).push(widget);
// Special legacy case
targetContainer = Container.Top;
}
(targetContainer === Container.Top ? topWidgets : rightWidgets).push(widget);
}

// Trim to MAX_PINNED
Expand Down Expand Up @@ -423,7 +422,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 },
});
Expand Down

0 comments on commit 82c2102

Please sign in to comment.