[IMP] mail: turn 'MessageView/authorAvatarTitleText' into field

Task-2793280

closes odoo/odoo#86458

Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2022-03-21 14:00:56 +01:00
parent d60f8e3293
commit 00d595af76
3 changed files with 11 additions and 7 deletions
@@ -169,12 +169,6 @@ export class Message extends Component {
get messageView() {
return this.messaging && this.messaging.models['MessageView'].get(this.props.localId);
}
/**
* @returns {string}
*/
get OPEN_CHAT() {
return this.env._t("Open chat");
}
/**
* Make this message viewable in its enclosing scroll environment (usually
@@ -29,7 +29,7 @@
<div class="o_Message_sidebar" t-att-class="{ 'o-message-squashed align-items-start': messageView.isSquashed }">
<t t-if="!messageView.isSquashed">
<div class="o_Message_authorAvatarContainer o_Message_sidebarItem">
<img class="o_Message_authorAvatar rounded-circle" t-att-class="{ o_Message_authorRedirect: messageView.hasAuthorOpenChat, o_redirect: messageView.hasAuthorOpenChat }" t-att-src="messageView.message.avatarUrl" t-on-click="_onClickAuthorAvatar" t-att-title="messageView.hasAuthorOpenChat ? OPEN_CHAT : ''" alt="Avatar"/>
<img class="o_Message_authorAvatar rounded-circle" t-att-class="{ o_Message_authorRedirect: messageView.hasAuthorOpenChat, o_redirect: messageView.hasAuthorOpenChat }" t-att-src="messageView.message.avatarUrl" t-on-click="_onClickAuthorAvatar" t-att-title="messageView.hasAuthorOpenChat ? messageView.authorAvatarTitleText : ''" alt="Avatar"/>
<t t-if="messageView.message.author and messageView.message.author.im_status">
<PartnerImStatusIcon
className="'o_Message_partnerImStatusIcon'"
@@ -107,6 +107,13 @@ registerModel({
? insertAndReplace()
: clear();
},
/**
* @private
* @returns {string}
*/
_computeAuthorAvatarTitleText() {
return this.env._t("Open chat");
},
/**
* @private
* @returns {string|FieldCommand}
@@ -168,6 +175,9 @@ registerModel({
isCausal: true,
readonly: true,
}),
authorAvatarTitleText: attr({
compute: '_computeAuthorAvatarTitleText',
}),
/**
* States the component displaying this message view (if any).
*/