From 1161951d96bfc3854fcc0a3563c7caf8249a392b Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 16 Jan 2017 14:13:32 +0100 Subject: [PATCH] [FIX] mail: notification authorization When user user denies Odoo to display desktop notifications, the message 'Permission granted' is displayed. opw-697985 --- addons/mail/static/src/js/client_action.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/js/client_action.js b/addons/mail/static/src/js/client_action.js index fe9ad84ba39..0476f58447a 100644 --- a/addons/mail/static/src/js/client_action.js +++ b/addons/mail/static/src/js/client_action.js @@ -123,8 +123,12 @@ var ChatAction = Widget.extend(ControlPanelMixin, { this.$(".o_mail_annoying_notification_bar").slideUp(); var def = window.Notification.requestPermission(); if (def) { - def.then(function () { - utils.send_notification('Permission granted', 'Odoo has now the permission to send you native notifications on this device.'); + def.then(function (value) { + if (value === 'denied') { + utils.send_notification('Permission denied', 'Odoo will not have the permission to send native notifications on this device.'); + } else { + utils.send_notification('Permission granted', 'Odoo has now the permission to send you native notifications on this device.'); + } }); } },