summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/js/models/threads/abstract_thread.js
diff options
context:
space:
mode:
authorAlexandre Kühn <aku@odoo.com>2018-11-20 10:26:06 +0000
committerAlexandre Kühn <aku@odoo.com>2018-11-20 10:52:26 +0000
commita13db188f3c2e26ddf45b3d12d64615bfe876171 (patch)
tree7835f15a89d390b3710ef216e034520cae34fd01 /addons/mail/static/src/js/models/threads/abstract_thread.js
parent09a2ef2e7c967a757c578eaa37c3e8bab80993f3 (diff)
[FIX] mail: notify when resetting unread counter of thread
Before this commit, we had the following issue: 1. Open two tabs A & B. 2. Receive a message from a channel in tab A. 3. Mark it as read in tab A by clicking on the chat window of the channel. > The unread counter is correct in tab A: no unread messages on this channel, and the messaging menu counter has been updated. > The unread counter is not correct in tab B: it still has unread messages on this channel, and the messaging menu counter has not been updated. The issue was caused by not notifying the updated unread counter to the widgets when receiving the 'channel_seen' notification from the longpoll. It was working in tab A because this is were we made the action, so that it already marked messages as read without waiting for the longpoll response. However, Tab B has to wait for the longpoll response to update the unread counter. It was updating the counter, but it was not notifying the widgets. This commit fixes the issue by letting the widgets know when the unread counter has been reset. Task-ID 1911239 closes odoo/odoo#28833
Diffstat (limited to 'addons/mail/static/src/js/models/threads/abstract_thread.js')
-rw-r--r--addons/mail/static/src/js/models/threads/abstract_thread.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/mail/static/src/js/models/threads/abstract_thread.js b/addons/mail/static/src/js/models/threads/abstract_thread.js
index 03bddd7d945..829f54581da 100644
--- a/addons/mail/static/src/js/models/threads/abstract_thread.js
+++ b/addons/mail/static/src/js/models/threads/abstract_thread.js
@@ -147,6 +147,7 @@ var AbstractThread = Class.extend(Mixins.EventDispatcherMixin, {
*/
resetUnreadCounter: function () {
this._unreadCounter = 0;
+ this._warnUpdatedUnreadCounter();
},
//--------------------------------------------------------------------------
@@ -177,7 +178,6 @@ var AbstractThread = Class.extend(Mixins.EventDispatcherMixin, {
*/
_markAsRead: function () {
this.resetUnreadCounter();
- this._warnUpdatedUnreadCounter();
return $.when();
},
/**