summaryrefslogtreecommitdiff
path: root/addons/mail/static/src/models/messaging_notification_handler
diff options
context:
space:
mode:
authorXavier Dubuc <xdu@odoo.com>2020-11-02 11:31:13 +0000
committerSébastien Theys <seb@odoo.com>2020-11-02 11:31:13 +0000
commit03481fd3df9bc53a17ba884ad4029ae46d7e54bf (patch)
tree4e374aad0a7a6c845ee605b77cbe4e282efb7391 /addons/mail/static/src/models/messaging_notification_handler
parentb3e31f2680534382b048324cfcb8a6f6c457553f (diff)
[FIX] mail: handle transient messages with (un)seen notions
task-2343887 closes odoo/odoo#60906 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/models/messaging_notification_handler')
-rw-r--r--addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js
index affa3c05a30..ac08419f590 100644
--- a/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js
+++ b/addons/mail/static/src/models/messaging_notification_handler/messaging_notification_handler.js
@@ -655,14 +655,19 @@ function factory(dependencies) {
*/
_handleNotificationPartnerTransientMessage(data) {
const convertedData = this.env.models['mail.message'].convertData(data);
- const messageIds = this.env.models['mail.message'].all().map(message => message.id);
+ const lastMessageId = this.env.models['mail.message'].all().reduce(
+ (lastMessageId, message) => Math.max(lastMessageId, message.id),
+ 0
+ );
const partnerRoot = this.env.messaging.partnerRoot;
const message = this.env.models['mail.message'].create(Object.assign(convertedData, {
author: [['link', partnerRoot]],
- id: (messageIds ? Math.max(...messageIds) : 0) + 0.01,
+ id: lastMessageId + 0.01,
isTransient: true,
}));
this._notifyThreadViewsMessageReceived(message);
+ // manually force recompute of counter
+ this.messaging.messagingMenu.update();
}
/**