[FIX] mail: message text content should not be blank on window resize

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) <seb@odoo.com>
This commit is contained in:
Alexandre Kühn
2022-12-01 14:34:18 +01:00
parent 4c2ed5a5f7
commit 8d445a6549
@@ -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 });
}