summaryrefslogtreecommitdiff
path: root/addons/mail_bot/static/src/js/notification_alert.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/mail_bot/static/src/js/notification_alert.js')
-rw-r--r--addons/mail_bot/static/src/js/notification_alert.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/mail_bot/static/src/js/notification_alert.js b/addons/mail_bot/static/src/js/notification_alert.js
new file mode 100644
index 00000000000..48b105dfe48
--- /dev/null
+++ b/addons/mail_bot/static/src/js/notification_alert.js
@@ -0,0 +1,26 @@
+odoo.define('mail.NotificationAlert', function (require) {
+"use strict";
+
+var Widget = require('web.Widget');
+var widgetRegistry = require('web.widget_registry');
+
+// -----------------------------------------------------------------------------
+// Display Notification alert on user preferences form view
+// -----------------------------------------------------------------------------
+var NotificationAlert = Widget.extend({
+ template: 'mail.NotificationAlert',
+ /**
+ * @override
+ */
+ init: function () {
+ this._super.apply(this, arguments);
+ var hasRequest = this.call('mailbot_service', 'isRequestingForNativeNotifications');
+ this.isNotificationBlocked = window.Notification && window.Notification.permission !== "granted" && !hasRequest;
+ },
+});
+
+widgetRegistry.add('notification_alert', NotificationAlert);
+
+return NotificationAlert;
+
+});