From 9ea5aecee8065db286977f0289039c6a53a263e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Wed, 14 Aug 2019 12:56:25 +0000 Subject: [FIX] mail: receive message then delayed needaction notifications Before this commit, when a user received a needaction notification on a message already stored locally, it crashed with this error: `TypeError: Cannot read property 'getThreadIDs' of undefined` This is caused by `addMessage` returning a Promise not resolved with the message when the message is not new. The returned promise should always be resolved with the message, in order to be consistent. closes odoo/odoo#35724 Signed-off-by: Martin Geubelle (mge) --- addons/mail/static/src/js/services/mail_manager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/mail/static/src/js/services/mail_manager.js') diff --git a/addons/mail/static/src/js/services/mail_manager.js b/addons/mail/static/src/js/services/mail_manager.js index 4a20d24af8d..3ed4031abeb 100644 --- a/addons/mail/static/src/js/services/mail_manager.js +++ b/addons/mail/static/src/js/services/mail_manager.js @@ -85,7 +85,7 @@ var MailManager = AbstractService.extend({ addMessage: function (data, options) { options = options || {}; var message = this.getMessage(data.id); - var prom = Promise.resolve(); + var prom; if (!message) { prom = this._addNewMessage(data, options); } else { @@ -95,6 +95,7 @@ var MailManager = AbstractService.extend({ }); } this._addMessageToThreads(message, options); + prom = Promise.resolve(message); } return prom; }, -- cgit v1.2.3