mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
left_sidebar: Hide menu option for home view if all messages are read.
This commit hides sidebar menu option button instead of showing it with "Mark all messages as read" option, for home view when there are no unread messages.
This commit is contained in:
@@ -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");
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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>");
|
||||
|
Reference in New Issue
Block a user