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.

left_sidebar: Hide menu option for home view if all messages are read.

Harshb7a943b8cbe8
diff --git a/web/src/left_sidebar_navigation_area.ts b/web/src/left_sidebar_navigation_area.ts
index 8945cb534c8..fd29fabca4a 100644
--- a/web/src/left_sidebar_navigation_area.ts
+++ b/web/src/left_sidebar_navigation_area.ts
@@ -76,6 +76,12 @@ export function update_dom_with_unread_counts(
ui_util.update_unread_count_in_dom($streams_header, counts.stream_unread_messages);
ui_util.update_unread_count_in_dom($back_to_streams, counts.stream_unread_messages);
+ if (counts.home_unread_messages === 0) {
+ $home_view_li.find(".sidebar-menu-icon").addClass("hide");
+ } else {
+ $home_view_li.find(".sidebar-menu-icon").removeClass("hide");
+ }
+
if (!skip_animations) {
animate_mention_changes($mentioned_li, counts.mentioned_message_count);
}
@@ -240,6 +246,10 @@ export function handle_home_view_changed(new_home_view: string): void {
const $new_home_view = get_view_rows_by_view_name(new_home_view);
const res = unread.get_counts();
+ if ($current_home_view.find(".sidebar-menu-icon").hasClass("hide")) {
+ $current_home_view.find(".sidebar-menu-icon").removeClass("hide");
+ }
+
// Remove class from current home view
$current_home_view.removeClass("selected-home-view");
diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css
index 25b8c02d8ed..f7620c5f48f 100644
--- a/web/styles/left_sidebar.css
+++ b/web/styles/left_sidebar.css
@@ -773,6 +773,10 @@ li.active-sub-filter {
}
}
+.sidebar-menu-icon.hide {
+ visibility: hidden;
+}
+
/* Don't show the scheduled messages item... */
li.top_left_scheduled_messages {
display: none;
diff --git a/web/tests/left_sidebar_navigation_area.test.cjs b/web/tests/left_sidebar_navigation_area.test.cjs
index 66435ddbf2c..618bf3f230e 100644
--- a/web/tests/left_sidebar_navigation_area.test.cjs
+++ b/web/tests/left_sidebar_navigation_area.test.cjs
@@ -104,6 +104,8 @@ run_test("update_count_in_dom", () => {
stream_unread_messages: 666,
};
+ $(".selected-home-view").set_find_results(".sidebar-menu-icon", $("<menu-icon>"));
+
make_elem($(".top_left_mentions"), "<mentioned-count>");
make_elem($(".top_left_inbox"), "<home-count>");