From f1ae9369aebeb34fca649bd68af8fdfd61449143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Thu, 12 Jul 2018 11:17:00 +0200 Subject: [PATCH] [FIX] mail: re-render thread once on newly added message When we add a new message, it should re-render the thread only once. The `addMessage` function must handles new messages and updated messages. Some code for updated messages should not be executed for new messages, which is what this commit does. --- .../mail/static/src/js/services/mail_manager.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/mail/static/src/js/services/mail_manager.js b/addons/mail/static/src/js/services/mail_manager.js index 8b34399b331..3af4f775e26 100644 --- a/addons/mail/static/src/js/services/mail_manager.js +++ b/addons/mail/static/src/js/services/mail_manager.js @@ -112,14 +112,15 @@ var MailManager = AbstractService.extend({ if (!options.silent) { this._mailBus.trigger('new_message', message); } - } - if (data.moderation_status === 'accepted') { - message.setModerationStatus('accepted', { - additionalThreadIDs: data.channel_ids - }); - } - if (options.domain && options.domain !== []) { - this._addMessageToThreads(message, options.domain); + } else { + if (data.moderation_status === 'accepted') { + message.setModerationStatus('accepted', { + additionalThreadIDs: data.channel_ids + }); + } + if (options.domain && options.domain !== []) { + this._addMessageToThreads(message, options.domain); + } } return message; },