Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
recent topics: Display other sender names in tooltip.
m-e-l-u-h-a-nfa34f793a709
diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.jsindex 6a36ff05741..52f40615f00 100644--- a/frontend_tests/node_tests/recent_topics.js+++ b/frontend_tests/node_tests/recent_topics.js@@ -293,6 +293,7 @@ function generate_topic_data(topic_info_array) {for (const [stream_id, topic, unread_count, muted, participated] of topic_info_array) {data.push({other_senders_count: 0,+ other_sender_names: "",invite_only: false,is_web_public: true,last_msg_time: "Just now",diff --git a/static/js/recent_topics.js b/static/js/recent_topics.jsindex ad3e186c7ec..2024ae0f791 100644--- a/static/js/recent_topics.js+++ b/static/js/recent_topics.js@@ -7,6 +7,7 @@ import render_recent_topics_body from "../templates/recent_topics_table.hbs";import * as compose_closed_ui from "./compose_closed_ui";import * as compose_state from "./compose_state";import * as hash_util from "./hash_util";+import {$t} from "./i18n";import * as ListWidget from "./list_widget";import {localstorage} from "./localstorage";import * as message_store from "./message_store";@@ -33,6 +34,7 @@ let topics_widget;// Sets the number of avatars to display.// Rest of the avatars, if present, are displayed as {+x}const MAX_AVATAR = 4;+const MAX_EXTRA_SENDERS = 10;// Use this to set the focused element.//@@ -317,6 +319,21 @@ function format_topic(topic_data) {const senders = all_senders.slice(-MAX_AVATAR);const senders_info = people.sender_info_for_recent_topics_row(senders);+ // Collect extra senders fullname for tooltip.+ const extra_sender_ids = all_senders.slice(0, -MAX_AVATAR);+ const displayed_other_senders = extra_sender_ids.slice(-MAX_EXTRA_SENDERS);+ const displayed_other_names = people.get_display_full_names(displayed_other_senders.reverse());++ if (extra_sender_ids.length > MAX_EXTRA_SENDERS) {+ // We display only 10 extra senders in tooltips,+ // and just display remaining number of senders.+ const remaining_senders = extra_sender_ids.length - MAX_EXTRA_SENDERS;+ displayed_other_names.push(+ $t({defaultMessage: `and {remaining_senders} other(s).`}, {remaining_senders}),+ );+ }+ const other_sender_names = displayed_other_names.join("<br/>");+return {// stream infostream_id,@@ -333,6 +350,7 @@ function format_topic(topic_data) {topic_url: hash_util.by_stream_topic_uri(stream_id, topic),senders: senders_info,other_senders_count: Math.max(0, all_senders.length - MAX_AVATAR),+ other_sender_names,muted,topic_muted,participated: topic_data.participated,diff --git a/static/templates/recent_topic_row.hbs b/static/templates/recent_topic_row.hbsindex 7e506014b4b..b0f152d0451 100644--- a/static/templates/recent_topic_row.hbs+++ b/static/templates/recent_topic_row.hbs@@ -32,7 +32,7 @@<td class='recent_topic_users'><ul class="recent_topics_participants">{{#if other_senders_count}}- <li class="recent_topics_participant_item">+ <li class="recent_topics_participant_item tippy-zulip-tooltip" data-tippy-content="{{other_sender_names}}" data-tippy-placement="top" data-tippy-allowHtml="true"><span class="recent_topics_participant_overflow">+{{other_senders_count}}</span></li>{{/if}}