Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

recent_view: Present one-line DMs with conditional tooltip.

Karl Stolleyc241775263a0
diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.ts
index ba00f4fa712..d2af8083a7a 100644
--- a/web/src/recent_view_ui.ts
+++ b/web/src/recent_view_ui.ts
@@ -617,6 +617,7 @@ type ConversationContext = {
is_private: true;
user_ids_string: string;
rendered_pm_with_html: string;
+ pm_users_as_plain: string;
pm_url: string;
is_group: boolean;
is_bot: boolean;
@@ -714,19 +715,32 @@ function format_conversation(conversation_data: ConversationData): ConversationC
// Direct message info
const user_ids_string = last_msg.to_user_ids;
assert(typeof last_msg.display_recipient !== "string");
+ const sorted_pm_users = last_msg.display_recipient
+ .filter(
+ (recipient: DisplayRecipientUser) =>
+ !people.is_my_user_id(recipient.id) || last_msg.display_recipient.length === 1,
+ )
+ .map((user: DisplayRecipientUser) => ({
+ name: people.get_display_full_name(user.id),
+ status_emoji_info: user_status.get_status_emoji(user.id),
+ }))
+ .toSorted((a, b) => util.strcmp(a.name, b.name));
+
const rendered_pm_with_html = render_users_with_status_icons({
- users: last_msg.display_recipient
- .filter(
- (recipient: DisplayRecipientUser) =>
- !people.is_my_user_id(recipient.id) ||
- last_msg.display_recipient.length === 1,
- )
- .map((user: DisplayRecipientUser) => ({
- name: people.get_display_full_name(user.id),
- status_emoji_info: user_status.get_status_emoji(user.id),
- }))
- .toSorted((a, b) => util.strcmp(a.name, b.name)),
+ users: sorted_pm_users,
});
+
+ const sorted_pm_usernames_only: string[] = [];
+
+ for (const user of sorted_pm_users) {
+ sorted_pm_usernames_only.push(user.name);
+ }
+
+ const pm_users_as_plain = util.format_array_as_list_with_conjunction(
+ sorted_pm_usernames_only,
+ "long",
+ );
+
const pm_url = last_msg.pm_with_url;
const is_group = last_msg.display_recipient.length > 2;
const has_unread_mention =
@@ -761,6 +775,7 @@ function format_conversation(conversation_data: ConversationData): ConversationC
dm_context = {
user_ids_string,
rendered_pm_with_html,
+ pm_users_as_plain,
pm_url,
is_group,
is_bot,
diff --git a/web/styles/recent_view.css b/web/styles/recent_view.css
index 238e87e4b7f..24e25177264 100644
--- a/web/styles/recent_view.css
+++ b/web/styles/recent_view.css
@@ -584,7 +584,7 @@
so prepare an ordinary inline layout... */
.user-status-microlayout {
display: inline;
- white-space: collapse;
+ white-space: nowrap;
}
/* ...and hide the status emoji. */
.status-emoji {
diff --git a/web/templates/recent_view_row.hbs b/web/templates/recent_view_row.hbs
index a7836707fdf..e603a599059 100644
--- a/web/templates/recent_view_row.hbs
+++ b/web/templates/recent_view_row.hbs
@@ -27,7 +27,7 @@
</div>
<i class="zulip-icon zulip-icon-chevron-right"></i>
{{#if is_private}}
- <a href="{{pm_url}}" class="recent-view-conversation-link recent-view-table-link {{#if is_group}}recent-view-dm-group{{else}}recent-view-dm{{/if}}" tabindex="-1">{{{rendered_pm_with_html}}}</a>
+ <a href="{{pm_url}}" class="recent-view-conversation-link recent-view-table-link {{#if is_group}}recent-view-dm-group{{else}}recent-view-dm{{/if}}" data-tippy-content="{{pm_users_as_plain}}" tabindex="-1">{{{rendered_pm_with_html}}}</a>
{{else}}
<a class="recent-view-conversation-link recent-view-table-link {{#if is_empty_string_topic}}empty-topic-display{{/if}}" data-tippy-content="{{topic_display_name}}" href="{{topic_url}}" tabindex="-1">{{topic_display_name}}</a>
{{/if}}