From 8b3a51f269422f64b2b83f029c24a6490b983c80 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 15 Nov 2021 11:01:30 +0100 Subject: [PATCH 1/2] save hide widget state --- src/components/structures/RoomView.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 3cf87e1bea1..fcbadff55fe 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -591,7 +591,7 @@ export class RoomView extends React.Component { const isManuallyShown = hideWidgetDrawer === "false"; const widgets = WidgetLayoutStore.instance.getContainerWidgets(room, Container.Top); - return widgets.length > 0 || isManuallyShown; + return widgets.length > 0 && isManuallyShown; } componentDidMount() { From d899a2a60de7a92b8831bf7f551432cd51150dab Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 15 Nov 2021 12:21:19 +0100 Subject: [PATCH 2/2] default to showWidgetDrawer = true (If setting is unset) --- src/components/structures/RoomView.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index fcbadff55fe..677090ad31b 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -583,15 +583,15 @@ export class RoomView extends React.Component { // Check if user has previously chosen to hide the app drawer for this // room. If so, do not show apps - const hideWidgetDrawer = localStorage.getItem( - room.roomId + "_hide_widget_drawer"); + const hideWidgetKey = room.roomId + "_hide_widget_drawer"; + const hideWidgetDrawer = localStorage.getItem(hideWidgetKey); - // This is confusing, but it means to say that we default to the tray being - // hidden unless the user clicked to open it. - const isManuallyShown = hideWidgetDrawer === "false"; + // If unset show the Tray + // Otherwise (in case the user set hideWidgetDrawer by clicking the button) follow the parameter. + const isManuallyShown = hideWidgetDrawer ? hideWidgetDrawer === "false": true; const widgets = WidgetLayoutStore.instance.getContainerWidgets(room, Container.Top); - return widgets.length > 0 && isManuallyShown; + return isManuallyShown && widgets.length > 0; } componentDidMount() {