From ae5be125404fa3bab1e6cc52874dc15b2efd35eb Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Fri, 21 Oct 2022 09:50:18 +0000 Subject: [PATCH] recent_topics_ui: Extend check for unread to PMs. Since we also have PMs now, `has_unread` should consider that case too. This seems like a good change regardless. --- static/js/recent_topics_ui.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/static/js/recent_topics_ui.js b/static/js/recent_topics_ui.js index e761a45f3f..0bfa688a0e 100644 --- a/static/js/recent_topics_ui.js +++ b/static/js/recent_topics_ui.js @@ -812,7 +812,10 @@ function is_focus_at_last_table_row() { function has_unread(row) { const last_msg_id = topics_widget.get_current_list()[row].last_msg_id; const last_msg = message_store.get(last_msg_id); - return unread.num_unread_for_topic(last_msg.stream_id, last_msg.topic) > 0; + if (last_msg.type === "stream") { + return unread.num_unread_for_topic(last_msg.stream_id, last_msg.topic) > 0; + } + return unread.num_unread_for_user_ids_string(last_msg.to_user_ids) > 0; } export function focus_clicked_element(topic_row_index, col, topic_key) {