From 63e0ef8d01b6bcbdc537e767326ab4651e550ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Thu, 27 Oct 2022 14:47:26 +0000 Subject: [PATCH] [FIX] mail: fix race condition in mail tour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the check for messaging happens after switching from channel to starred (where there is no composer) it would crash when using `this`. closes odoo/odoo#104392 X-original-commit: d3091762cc5769ed13b5a828769bcd03f440a8f8 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/models/composer_view.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/models/composer_view.js b/addons/mail/static/src/models/composer_view.js index a05f1691596..d4d8111cea7 100644 --- a/addons/mail/static/src/models/composer_view.js +++ b/addons/mail/static/src/models/composer_view.js @@ -573,8 +573,8 @@ registerModel({ const message = messaging.models['Message'].insert( messaging.models['Message'].convertData(messageData) ); - if (this.messaging.hasLinkPreviewFeature && !message.isBodyEmpty) { - this.messaging.rpc({ + if (messaging.hasLinkPreviewFeature && !message.isBodyEmpty) { + messaging.rpc({ route: `/mail/link_preview`, params: { message_id: message.id