[FIX] mail: fix race condition in mail tour

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) <aku@odoo.com>
This commit is contained in:
Sébastien Theys
2022-10-27 20:53:44 +02:00
parent aea67604b4
commit 63e0ef8d01
@@ -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