[FIX] mail: display notification when explicitly grant it

Instead of looking for the "denied" permission, rather look for the "granted"
since there are three permissions: "default", "denied", "granted" - only
"granted" counts toward permission actually being granted

Closes #22633
This commit is contained in:
adekock11
2018-01-31 10:44:00 +01:00
committed by Martin Trigaux
parent 93c4c5cfb1
commit 9dce2be273
+3 -3
View File
@@ -124,10 +124,10 @@ var ChatAction = Widget.extend(ControlPanelMixin, {
var def = window.Notification && window.Notification.requestPermission();
if (def) {
def.then(function (value) {
if (value === 'denied') {
utils.send_notification(_t('Permission denied'), _t('Odoo will not have the permission to send native notifications on this device.'));
} else {
if (value === 'granted') {
utils.send_notification(_t('Permission granted'), _t('Odoo has now the permission to send you native notifications on this device.'));
} else {
utils.send_notification(_t('Permission denied'), _t('Odoo will not have the permission to send native notifications on this device.'));
}
});
}