From e331c38ee7e003c034401d12a2eab306a4c4f9b4 Mon Sep 17 00:00:00 2001 From: Thanh Dodeur Date: Fri, 7 Oct 2022 07:30:17 +0000 Subject: [PATCH] [FIX] im_livechat: show the avatar of logged users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, the author of the messages in the livechat would only have an avatar if it was an operator. But logged users would not have their avatar displayed. This commit fixes this issue by fetching the avatar when possible. taskid-3006025 closes odoo/odoo#102739 X-original-commit: 2a5c6c4bc494faecccb86e4b8ad33dab3476b363 Signed-off-by: Alexandre Kühn (aku) --- .../static/src/legacy/models/public_livechat_message.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/im_livechat/static/src/legacy/models/public_livechat_message.js b/addons/im_livechat/static/src/legacy/models/public_livechat_message.js index 1d1a2f21eab..06832b3e480 100644 --- a/addons/im_livechat/static/src/legacy/models/public_livechat_message.js +++ b/addons/im_livechat/static/src/legacy/models/public_livechat_message.js @@ -73,8 +73,10 @@ const PublicLivechatMessage = Class.extend({ */ getAvatarSource() { let source = this._serverURL; - if (this.hasAuthor()) { + if (this.isOperatorTheAuthor()) { source += `/im_livechat/operator/${this.getAuthorID()}/avatar`; + } else if (this.hasAuthor() && session.user_id) { + source += `/web/image/res.partner/${this.getAuthorID()}/avatar_128`; } else { source += '/mail/static/src/img/smiley/avatar.jpg'; }