[FIX] mail: clean chat window thread avatar

Remove uncessary ThreadIcon that only served as spacing, properly add
module icon for chatter records.

closes odoo/odoo#125388

Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Sébastien Theys
2023-06-19 16:39:56 +02:00
parent 517c206cb5
commit 70eb043ccf
3 changed files with 15 additions and 12 deletions
@@ -17,12 +17,9 @@
<div t-if="ui.isSmall" class="cursor-pointer d-flex align-items-center h-100 px-3 py-0 me-2" title="Close conversation" t-on-click="() => this.close()">
<i class="oi oi-arrow-left"/>
</div>
<div t-if="thread and thread.model === 'discuss.channel'" class="o-mail-ChatWindow-threadAvatar my-0" t-att-class="{ 'ms-3': !ui.isSmall, 'me-1': thread.type === 'chat', 'me-3': thread.type !== 'chat' }">
<div t-if="thread" class="o-mail-ChatWindow-threadAvatar my-0" t-att-class="{ 'ms-3': !ui.isSmall, 'me-1': thread.type === 'chat', 'me-3': thread.type !== 'chat' }">
<img class="rounded" t-att-src="thread.imgUrl" alt="Thread Image"/>
</div>
<t t-else="">
<ThreadIcon t-if="thread" thread="thread" className="'ms-3 me-1 my-0'"/>
</t>
<ThreadIcon t-if="thread and thread.type === 'chat' and thread.correspondent" thread="thread" className="'me-1'"/>
<span class="o-mail-ChatWindow-name text-truncate fw-bold" t-att-title="props.chatWindow.displayName" t-esc="props.chatWindow.displayName" t-att-class="{
'ms-3 me-1 my-0': !thread,
@@ -240,10 +240,13 @@ export class MessageService {
linkPreviews = message.linkPreviews,
message_type: type = message.type,
model: resModel = message.resModel,
module_icon,
notifications = message.notifications,
parentMessage,
recipients = message.recipients,
record_name,
res_id: resId = message.resId,
res_model_name,
subtype_description: subtypeDescription = message.subtypeDescription,
...remainingData
} = data;
@@ -263,11 +266,12 @@ export class MessageService {
type,
});
// origin thread before other information (in particular notification insert uses it)
if (data.record_name) {
message.originThread.name = data.record_name;
}
if (data.res_model_name) {
message.originThread.modelName = data.res_model_name;
if (message.originThread) {
assignDefined(message.originThread, {
modelName: res_model_name || undefined,
module_icon: module_icon || undefined,
name: record_name || undefined,
});
}
replaceArrayWithCompare(
message.attachments,
@@ -76,6 +76,10 @@ export class Thread {
* @type {import("@mail/core/common/message_model").Message[]}
*/
messages = [];
/** @type {string} */
modelName;
/** @type {string} */
module_icon;
/**
* Contains messages received from the bus that are not yet inserted in
* `messages` list. This is a temporary storage to ensure nothing is lost
@@ -251,9 +255,7 @@ export class Thread {
}
get imgUrl() {
return (
this.newestNeedactionMessage?.module_icon ?? "/mail/static/src/img/smiley/avatar.jpg"
);
return this.module_icon ?? "/mail/static/src/img/smiley/avatar.jpg";
}
get allowDescription() {