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

Respect the roomState right container request for the Jitsi widget #7033

Merged
merged 3 commits into from
Oct 26, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/stores/widgets/WidgetLayoutStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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){
jryans marked this conversation as resolved.
Show resolved Hide resolved
targetContainer = (manualContainer) ? manualContainer : stateContainer;
}
// Special legacy case
else if (isLegacyPinned && !stateContainer) {
targetContainer = Container.Top;
}
(targetContainer === Container.Top ? topWidgets : rightWidgets).push(widget);
jryans marked this conversation as resolved.
Show resolved Hide resolved
}

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