From e5479fcfdb76bdbf9301fb140d873483bafdb9e4 Mon Sep 17 00:00:00 2001 From: Julien Giannone Date: Thu, 4 Apr 2019 09:09:57 +0000 Subject: [IMP] mail: prevent message loss during connection issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the changes, when a message was posted (on Discuss or in the chat window), the composer was cleared directly as it didn't wait for the rpc response. If there was latency or a connection loss, the message disappeared from the composer but took time to appear in the content window or didn't appear at all and was lost. Now, the composer waits for the rpc response and then is cleared. Task #1957856 closes odoo/odoo#32422 Signed-off-by: Alexandre Kühn (aku) --- addons/mail/static/src/js/composers/basic_composer.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'addons/mail/static/src/js/composers/basic_composer.js') diff --git a/addons/mail/static/src/js/composers/basic_composer.js b/addons/mail/static/src/js/composers/basic_composer.js index 72936152ae5..c84296d55d1 100644 --- a/addons/mail/static/src/js/composers/basic_composer.js +++ b/addons/mail/static/src/js/composers/basic_composer.js @@ -510,9 +510,10 @@ var BasicComposer = Widget.extend({ clearTimeout(this._cannedTimeout); var self = this; this._preprocessMessage().then(function (message) { - self.trigger('post_message', message); - self._clearComposerOnSend(); - self.$input.focus(); + self.trigger('post_message', message, function() { + self._clearComposerOnSend(); + self.$input.focus(); + }); }); }, /** -- cgit v1.2.3