diff options
| author | mgh-odoo <mgh@odoo.com> | 2019-07-31 12:51:10 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2020-02-05 09:59:52 +0000 |
| commit | 4da64b3f3c8dff88d8e0e01c65374590cc0bf4f7 (patch) | |
| tree | cfc7d9b87178feffb10dc2a9fea563fcb6c4f186 /addons/mail/static/src/js/services/mail_notification_manager.js | |
| parent | 474643b1c1341d8f5956e7a18bfde14ff0e9d662 (diff) | |
[IMP] mail: email channels duplicated notifications
This commit prevents sending a notification within Odoo when a
message is posted from a mailing channel to a user whose notification
management preference is set to "Handle by Emails".
Task-ID 2033302
closes odoo/odoo#36000
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/mail/static/src/js/services/mail_notification_manager.js')
| -rw-r--r-- | addons/mail/static/src/js/services/mail_notification_manager.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/addons/mail/static/src/js/services/mail_notification_manager.js b/addons/mail/static/src/js/services/mail_notification_manager.js index 9cef9742747..ba9230eb32b 100644 --- a/addons/mail/static/src/js/services/mail_notification_manager.js +++ b/addons/mail/static/src/js/services/mail_notification_manager.js @@ -97,9 +97,14 @@ MailManager.include({ _handleChannelMessageNotification: function (messageData) { var self = this; var def; - var channelAlreadyInCache = true; + let notify = true; if (messageData.channel_ids.length === 1) { - channelAlreadyInCache = !!this.getChannel(messageData.channel_ids[0]); + const channel = this.getChannel(messageData.channel_ids[0]); + // Message from mailing channel should not make a notification in Odoo for users + // with notification "Handled by Email", but web client should receive the message. + // Channel has been marked as read server-side in this case, so it should not display + // a notification by incrementing the unread counter. + notify = channel && (!channel.isMassMailing() || session.notification_type !== 'email'); def = this.joinChannel(messageData.channel_ids[0], { autoswitch: false }); } else { def = Promise.resolve(); @@ -109,7 +114,7 @@ MailManager.include({ // its unread counter has just been fetched return self.addMessage(messageData, { showNotification: true, - incrementUnread: channelAlreadyInCache + incrementUnread: notify, }); }); }, |
