Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
unread: Show unread count for only 1:1 human PMs for right sidebar icon.
N-Shar-ma0e55b2aed913
diff --git a/static/js/unread.js b/static/js/unread.jsindex 818c80c74d3..278850ef76d 100644--- a/static/js/unread.js+++ b/static/js/unread.js@@ -154,14 +154,22 @@ class UnreadPMCounter {get_counts() {const pm_dict = new Map(); // Hash by user_ids_string -> countlet total_count = 0;+ let right_sidebar_count = 0;for (const [user_ids_string, id_set] of this.bucketer) {const count = id_set.size;pm_dict.set(user_ids_string, count);+ const user_ids = people.user_ids_string_to_ids_array(user_ids_string);+ const is_with_one_human =+ user_ids.length === 1 && !people.get_by_user_id(user_ids[0]).is_bot;+ if (is_with_one_human) {+ right_sidebar_count += count;+ }total_count += count;}return {total_count,pm_dict,+ right_sidebar_count,};}@@ -704,6 +712,7 @@ export function get_counts() {const pm_res = unread_pm_counter.get_counts();res.pm_count = pm_res.pm_dict;res.private_message_count = pm_res.total_count;+ res.right_sidebar_private_message_count = pm_res.right_sidebar_count;res.home_unread_messages += pm_res.total_count;return res;diff --git a/static/js/unread_ui.js b/static/js/unread_ui.jsindex 92194e11869..eefaf1f9a74 100644--- a/static/js/unread_ui.js+++ b/static/js/unread_ui.js@@ -84,7 +84,12 @@ export function update_unread_counts() {// Set the unread counts that we show in the buttons that// toggle open the sidebar menus when we have a thin window.set_count_toggle_button($("#streamlist-toggle-unreadcount"), res.home_unread_messages);- set_count_toggle_button($("#userlist-toggle-unreadcount"), res.private_message_count);+ // Bots and group PMs do not appear in the right sidebar user list, so+ // we show unread count for only non bot 1:1 private messages there.+ set_count_toggle_button(+ $("#userlist-toggle-unreadcount"),+ res.right_sidebar_private_message_count,+ );}export function should_display_bankruptcy_banner() {