Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

right-sidebar: Isolate hide-right-sidebar persistance from spectators.

Tim Abbottc8444fc0ceb0
diff --git a/web/src/sidebar_ui.ts b/web/src/sidebar_ui.ts
index 6a92ba48053..1afdbdea997 100644
--- a/web/src/sidebar_ui.ts
+++ b/web/src/sidebar_ui.ts
@@ -27,7 +27,12 @@ import {user_settings} from "./user_settings.ts";
function save_sidebar_toggle_status(): void {
const ls = localstorage();
ls.set("left-sidebar", $("body").hasClass("hide-left-sidebar"));
- ls.set("right-sidebar", $("body").hasClass("hide-right-sidebar"));
+
+ if (!page_params.is_spectator) {
+ // The right sidebar is never shown in the spectator mode;
+ // avoid interacting with local storage state for it.
+ ls.set("right-sidebar", $("body").hasClass("hide-right-sidebar"));
+ }
}
export function restore_sidebar_toggle_status(): void {
@@ -35,7 +40,11 @@ export function restore_sidebar_toggle_status(): void {
if (ls.get("left-sidebar")) {
$("body").addClass("hide-left-sidebar");
}
- if (ls.get("right-sidebar")) {
+
+ if (!page_params.is_spectator && ls.get("right-sidebar")) {
+ // The right sidebar is never shown in the spectator mode;
+ // avoid processing local storage state for hiding the right
+ // sidebar.
$("body").addClass("hide-right-sidebar");
}
}