From 8d445a6549363254085ecf04151326e3d9d4eb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 1 Dec 2022 10:28:13 +0000 Subject: [PATCH] [FIX] mail: message text content should not be blank on window resize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, when resizing window so that chatter swap position, the text content of message disappeared. This happens because OWL re-render the message view as completely different DOM elements, while modeling in discuss code kept identity of the MessageView. As a result, the message text content was unchanged therefore it was not updated in the DOM, thus staying blank. This commit fixes the issue by enforcing setting the message text content in DOM whenever the value is empty in DOM but the message has logically some text content. closes odoo/odoo#106978 Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/message_view.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/models/message_view.js b/addons/mail/static/src/models/message_view.js index bef47e9ea42..d488451344c 100644 --- a/addons/mail/static/src/models/message_view.js +++ b/addons/mail/static/src/models/message_view.js @@ -129,7 +129,11 @@ Model({ this.message ); } - if (this.prettyBodyRef.el && this.message.prettyBody !== this.lastPrettyBody) { + if ( + this.prettyBodyRef.el && + (this.message.prettyBody !== this.lastPrettyBody || + (this.message.prettyBody && this.prettyBodyRef.el.innerHTML === "")) + ) { this.prettyBodyRef.el.innerHTML = this.message.prettyBody; this.update({ lastPrettyBody: this.message.prettyBody }); }