[FIX] mail: notification authorization

When user user denies Odoo to display desktop notifications, the message
'Permission granted' is displayed.

opw-697985
This commit is contained in:
Nicolas Martinelli
2017-01-16 15:49:05 +01:00
parent c0e02f089b
commit 1161951d96
+6 -2
View File
@@ -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.');
}
});
}
},