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.

inbox_ui: Fix buggy save and restore of navigation state.

Aman Agrawaladb2884d5962
diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts
index b57de6a032c..cf1890aefbc 100644
--- a/web/src/inbox_ui.ts
+++ b/web/src/inbox_ui.ts
@@ -257,6 +257,7 @@ function restore_inbox_view_state(): void {
export function show(filter?: Filter): void {
assert(hide_other_views_callback !== undefined);
hide_other_views_callback();
+ const was_inbox_already_visible = inbox_util.is_visible();
// Avoid setting col_focus to recipient when moving to inbox from other narrows.
// We prefer to focus entire row instead of stream name for inbox-header.
// Since inbox-row doesn't has a collapse button, focus on COLUMNS.COLLAPSE_BUTTON
@@ -279,11 +280,11 @@ export function show(filter?: Filter): void {
// do anything here if view for the same channel is visible.
return;
}
- } else if (!was_inbox_channel_view && is_new_filter_channel_view) {
+ } else if (was_inbox_already_visible && !was_inbox_channel_view && is_new_filter_channel_view) {
save_inbox_view_state();
}
- if (was_inbox_channel_view) {
+ if (was_inbox_already_visible && was_inbox_channel_view) {
save_channel_view_state();
}
@@ -358,6 +359,12 @@ export function hide(): void {
set_visible: inbox_util.set_visible,
});
+ if (inbox_util.is_channel_view()) {
+ save_channel_view_state();
+ } else {
+ save_inbox_view_state();
+ }
+
inbox_util.set_filter(undefined);
}