From a0cedbde0d6ff319bf114fdc7ceba29becad6174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Tue, 15 Mar 2022 12:59:19 +0000 Subject: [PATCH] [IMP] mail: turn 'Message/avatarUrl' into field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-2793280 closes odoo/odoo#86446 Signed-off-by: Alexandre Kühn (aku) --- .../static/src/components/message/message.js | 21 ---------------- .../static/src/components/message/message.xml | 2 +- addons/mail/static/src/models/message.js | 24 +++++++++++++++++++ 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/addons/mail/static/src/components/message/message.js b/addons/mail/static/src/components/message/message.js index 5b48beaa63d..4f335ede230 100644 --- a/addons/mail/static/src/components/message/message.js +++ b/addons/mail/static/src/components/message/message.js @@ -87,27 +87,6 @@ export class Message extends Component { // Public //-------------------------------------------------------------------------- - /** - * @returns {string} - */ - get avatar() { - if (this.messageView.message.author && (!this.messageView.message.originThread || this.messageView.message.originThread.model !== 'mail.channel')) { - // TODO FIXME for public user this might not be accessible. task-2223236 - // we should probably use the correspondig attachment id + access token - // or create a dedicated route to get message image, checking the access right of the message - return this.messageView.message.author.avatarUrl; - } else if (this.messageView.message.author && this.messageView.message.originThread && this.messageView.message.originThread.model === 'mail.channel') { - return `/mail/channel/${this.messageView.message.originThread.id}/partner/${this.messageView.message.author.id}/avatar_128`; - } else if (this.messageView.message.guestAuthor && (!this.messageView.message.originThread || this.messageView.message.originThread.model !== 'mail.channel')) { - return this.messageView.message.guestAuthor.avatarUrl; - } else if (this.messageView.message.guestAuthor && this.messageView.message.originThread && this.messageView.message.originThread.model === 'mail.channel') { - return `/mail/channel/${this.messageView.message.originThread.id}/guest/${this.messageView.message.guestAuthor.id}/avatar_128?unique=${this.messageView.message.guestAuthor.name}`; - } else if (this.messageView.message.message_type === 'email') { - return '/mail/static/src/img/email_icon.png'; - } - return '/mail/static/src/img/smiley/avatar.jpg'; - } - /** * Get the date time of the message at current user locale time. * diff --git a/addons/mail/static/src/components/message/message.xml b/addons/mail/static/src/components/message/message.xml index 368c6faddea..4e9636655a6 100644 --- a/addons/mail/static/src/components/message/message.xml +++ b/addons/mail/static/src/components/message/message.xml @@ -29,7 +29,7 @@
- Avatar + Avatar