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.
This commit is contained in:
Aman Agrawal 2022-10-21 09:50:18 +00:00 committed by Tim Abbott
parent eb45b8ab70
commit ae5be12540
1 changed files with 4 additions and 1 deletions

View File

@ -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);
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) {