inbox: Show group pms without status icons.

This commit is contained in:
Aman Agrawal 2023-09-22 10:47:56 +00:00 committed by Tim Abbott
parent 1bd50e60ec
commit 4fcc488db5
3 changed files with 58 additions and 25 deletions

View File

@ -4,6 +4,7 @@ import _ from "lodash";
import render_inbox_row from "../templates/inbox_view/inbox_row.hbs";
import render_inbox_stream_container from "../templates/inbox_view/inbox_stream_container.hbs";
import render_inbox_view from "../templates/inbox_view/inbox_view.hbs";
import render_user_with_status_icon from "../templates/user_with_status_icon.hbs";
import * as buddy_data from "./buddy_data";
import * as compose_closed_ui from "./compose_closed_ui";
@ -27,6 +28,7 @@ import * as sub_store from "./sub_store";
import * as unread from "./unread";
import * as unread_ops from "./unread_ops";
import * as unread_ui from "./unread_ui";
import * as user_status from "./user_status";
import * as user_topics from "./user_topics";
import * as util from "./util";
@ -193,20 +195,30 @@ function format_dm(user_ids_string, unread_count) {
}
const reply_to = people.user_ids_string_to_emails_string(user_ids_string);
const recipients_info = [];
const rendered_dm_with = recipient_ids
.map((recipient_id) =>
render_user_with_status_icon({
name: people.get_display_full_name(recipient_id),
status_emoji_info: user_status.get_status_emoji(recipient_id),
}),
)
.sort()
.join(", ");
for (const user_id of recipient_ids) {
const recipient_user_obj = people.get_by_user_id(user_id);
if (!recipient_user_obj.is_bot) {
const user_circle_class = buddy_data.get_user_circle_class(user_id);
recipient_user_obj.user_circle_class = user_circle_class;
}
recipients_info.push(recipient_user_obj);
let user_circle_class;
let is_bot = false;
if (recipient_ids.length === 1) {
is_bot = people.get_by_user_id(recipient_ids[0]).is_bot;
user_circle_class = is_bot ? false : buddy_data.get_user_circle_class(recipient_ids[0]);
}
const context = {
conversation_key: user_ids_string,
is_direct: true,
recipients_info,
rendered_dm_with,
is_group: recipient_ids.length > 1,
user_circle_class,
is_bot,
dm_url: hash_util.pm_with_url(reply_to),
user_ids_string,
unread_count,

View File

@ -157,10 +157,6 @@
}
}
.fa-group {
margin-right: 7px;
}
.fa-lock {
margin-right: 3px;
}
@ -204,9 +200,10 @@
}
.zulip-icon-bot {
opacity: 0.7;
font-size: 11px;
margin-left: -2px;
margin-right: 5px;
margin-left: 1px;
}
.inbox-row {
@ -312,20 +309,44 @@
cursor: pointer;
}
.inbox-group-or-bot-dm {
position: relative;
left: -3px;
}
.recipients_info {
display: flex;
flex-wrap: wrap;
column-gap: 10px;
grid-area: recipient_info;
overflow: hidden;
.user_block {
display: flex;
align-items: center;
white-space: nowrap;
overflow: hidden;
.fa-group {
font-size: 11px;
margin-right: 5px;
align-self: flex-start;
margin-top: 5px;
opacity: 0.7;
}
.user_status_icon_wrapper {
overflow: hidden;
text-overflow: ellipsis;
}
}
.recipients_name {
display: flex;
flex-wrap: wrap;
white-space: nowrap;
gap: 2px;
overflow: hidden;
}
}
}

View File

@ -7,17 +7,17 @@
<div class="inbox-left-part">
<div class="hide fake-collapse-button" tabindex="0"></div>
{{#if is_direct}}
<a class="recipients_info" href="{{dm_url}}">
{{#each recipients_info}}
<span class="user_block">
{{#if is_bot}}
<span class="zulip-icon zulip-icon-bot" aria-hidden="true"></span>
{{else}}
<span class="{{user_circle_class}} user_circle"></span>
{{/if}}
<span class="recipients_name">{{full_name}}</span>
</span>
{{/each}}
<a class="recipients_info {{#unless user_circle_class}}inbox-group-or-bot-dm{{/unless}}" href="{{dm_url}}">
<span class="user_block">
{{#if is_bot}}
<span class="zulip-icon zulip-icon-bot" aria-hidden="true"></span>
{{else if is_group}}
<span class="fa fa-group" aria-hidden="true"></span>
{{else}}
<span class="{{user_circle_class}} user_circle"></span>
{{/if}}
<span class="recipients_name">{{{rendered_dm_with}}}</span>
</span>
</a>
<span class="unread_count tippy-zulip-tooltip on_hover_dm_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>
{{else if is_topic}}