Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
recent_topics_ui: Allow unread count click in PM row to mark row as read.
Aman Agrawal12d42320ff65
diff --git a/static/js/click_handlers.js b/static/js/click_handlers.jsindex 4e349fda065..3cb75c7be23 100644--- a/static/js/click_handlers.js+++ b/static/js/click_handlers.js@@ -447,11 +447,20 @@ export function initialize() {$("body").on("click", "#recent_topics_table .on_hover_topic_read", (e) => {e.stopPropagation();- const topic_row_index = $(e.target).closest("tr").index();+ const $elt = $(e.currentTarget);+ const topic_row_index = $elt.closest("tr").index();recent_topics_ui.focus_clicked_element(topic_row_index, recent_topics_ui.COLUMNS.read);- const stream_id = Number.parseInt($(e.currentTarget).attr("data-stream-id"), 10);- const topic = $(e.currentTarget).attr("data-topic-name");- unread_ops.mark_topic_as_read(stream_id, topic);+ const user_ids_string = $elt.attr("data-user-ids-string");+ if (user_ids_string) {+ // PM row+ unread_ops.mark_pm_as_read(user_ids_string);+ } else {+ // Stream row+ const stream_id = Number.parseInt($elt.attr("data-stream-id"), 10);+ const topic = $elt.attr("data-topic-name");+ unread_ops.mark_topic_as_read(stream_id, topic);+ }+ recent_topics_ui.change_focused_element($elt, "down_arrow");});$("body").on("keydown", ".on_hover_topic_read", ui_util.convert_enter_to_click);diff --git a/static/js/recent_topics_ui.js b/static/js/recent_topics_ui.jsindex 0bfa688a0ef..9548ef9597c 100644--- a/static/js/recent_topics_ui.js+++ b/static/js/recent_topics_ui.js@@ -78,7 +78,7 @@ export const COLUMNS = {// increased when we add new actions, or rethought if we add optional// actions that only appear in some rows.const MAX_SELECTABLE_TOPIC_COLS = 4;-const MAX_SELECTABLE_PM_COLS = 2;+const MAX_SELECTABLE_PM_COLS = 3;// we use localstorage to persist the recent topic filtersconst ls_key = "recent_topic_filters";@@ -357,6 +357,7 @@ function format_conversation(conversation_data) {displayed_other_senders = extra_sender_ids.slice(-MAX_EXTRA_SENDERS);} else if (type === "private") {// Private message info+ context.user_ids_string = last_msg.to_user_ids;context.pm_with = last_msg.display_reply_to;context.recipient_id = last_msg.recipient_id;context.pm_url = last_msg.pm_with_url;@@ -873,8 +874,7 @@ function down_arrow_navigation(row, col) {if (is_focus_at_last_table_row()) {return;}- const type = get_row_type(row);- if (type === "stream" && col === 2 && !has_unread(row + 1)) {+ if (col === 2 && !has_unread(row + 1)) {col_focus = 1;}row_focus += 1;diff --git a/static/styles/recent_topics.css b/static/styles/recent_topics.cssindex e267268859a..9b64780c395 100644--- a/static/styles/recent_topics.css+++ b/static/styles/recent_topics.css@@ -163,13 +163,6 @@background-color: hsl(105, 2%, 50%);}- .unread_count_pm {- /* 10px of unread count + 23px for bell icon */- margin-right: 33px;- /* match the opacity with topic unread count without hover */- opacity: 0.7;- }-.unread_mention_info:not(:empty) {margin-right: -5px;}@@ -220,6 +213,12 @@.recent_topic_actions .recent_topics_focusable {display: flex;align-items: center;+ padding-bottom: 3px;++ &.single_action_button {+ /* 10px of unread count + 23px for bell icon */+ margin-right: 33px;+ }}.recent_topics_participants {diff --git a/static/templates/recent_topic_row.hbs b/static/templates/recent_topic_row.hbsindex ca852583585..7a0bfa0a1d3 100644--- a/static/templates/recent_topic_row.hbs+++ b/static/templates/recent_topic_row.hbs@@ -37,7 +37,11 @@</div><div class="right_part">{{#if is_private}}- <span class="unread_count unread_count_pm {{#unless unread_count}}unread_hidden{{/unless}}">{{unread_count}}</span>+ <div class="recent_topic_actions">+ <div class="recent_topics_focusable single_action_button">+ <span class="unread_count unread_count_pm {{#unless unread_count}}unread_hidden{{/unless}} tippy-zulip-tooltip on_hover_topic_read" data-user-ids-string="{{user_ids_string}}" data-tippy-content="{{t 'Mark as read' }}" role="button" tabindex="0" aria-label="{{t 'Mark as read' }}">{{unread_count}}</span>+ </div>+ </div>{{else}}<span class="unread_mention_info {{#unless mention_in_unread}}unread_hidden{{/unless}}">@</span><div class="recent_topic_actions">