From 76e0cb3e9541fbc700ee22881e75d506d99fab78 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 14 Feb 2017 19:42:18 +0100 Subject: [PATCH] [FIX] mail: do not update count if message in no channel When a message is not part of any channel, the message counter is incremented while the message won't appear in any channel. This leads to an inconsistency between the number of messages displayed in the status bar and the actual messages in Discuss. opw-706884 --- addons/mail/static/src/js/chat_manager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/chat_manager.js b/addons/mail/static/src/js/chat_manager.js index e8dd83d9017..8e0c9b83d7f 100644 --- a/addons/mail/static/src/js/chat_manager.js +++ b/addons/mail/static/src/js/chat_manager.js @@ -479,7 +479,9 @@ function on_needaction_notification (message) { increment_unread: true, }); invalidate_caches(message.channel_ids); - needaction_counter++; + if (message.channel_ids.length !== 0) { + needaction_counter++; + } _.each(message.channel_ids, function (channel_id) { var channel = chat_manager.get_channel(channel_id); if (channel) {