left_sidebar: Show sidebar menu icon for muted unread messages.

It was reported that there was no option to mark messages as read
when only unread messages in muted streams and topics remained.

This happened because the logic to show or hide the sidebar menu
icon relied solely on the home view count, which excludes unread
messages in muted streams and topics.

This commit fixes the issue by including the count of unread
messages in muted streams and topics when determining whether to
show or hide the sidebar menu icon.

Fixes: #34682
This commit is contained in:
whilstsomebody
2025-06-02 18:48:38 +05:30
committed by Tim Abbott
parent e5716faea4
commit d70f7ba9e1
2 changed files with 6 additions and 1 deletions

View File

@@ -76,7 +76,9 @@ 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) {
const show_sidebar_menu_icon =
counts.home_unread_messages + counts.muted_topic_unread_messages_count > 0;
if (!show_sidebar_menu_icon) {
$home_view_li.find(".sidebar-menu-icon").addClass("hide");
} else {
$home_view_li.find(".sidebar-menu-icon").removeClass("hide");

View File

@@ -912,6 +912,7 @@ export type FullUnreadCountsData = {
stream_unread_messages: number;
followed_topic_unread_messages_count: number;
followed_topic_unread_messages_with_mention_count: number;
muted_topic_unread_messages_count: number;
stream_count: Map<number, StreamCountInfo>;
streams_with_mentions: number[];
streams_with_unmuted_mentions: number[];
@@ -938,6 +939,8 @@ export function get_counts(): FullUnreadCountsData {
followed_topic_unread_messages_count: topic_res.followed_topic_unread_messages,
followed_topic_unread_messages_with_mention_count:
unread_topic_counter.get_followed_topic_unread_mentions(),
muted_topic_unread_messages_count:
unread_messages.size - topic_res.stream_unread_messages - pm_res.total_count,
stream_count: topic_res.stream_count,
streams_with_mentions: [...unread_topic_counter.get_streams_with_unread_mentions()],
streams_with_unmuted_mentions: [