summaryrefslogtreecommitdiff
path: root/addons/mail_bot/static/src
diff options
context:
space:
mode:
authorJuhil Somaiya <jso@odoo.com>2019-01-23 09:32:01 +0000
committerJuhil Somaiya <jso@odoo.com>2019-02-15 09:05:54 +0000
commit02eebe15cd895b54f45cbcef1affcaa61ec8577c (patch)
tree85d7ddee92dbe048aabf43243a0e2c949ad516db /addons/mail_bot/static/src
parentb35d103cc0fe64547c3212ef01ab329faf0bacc4 (diff)
[IMP] mail_bot: Blocked notification alert to User
If user has blocked odoo push notifications then there's no way to enable via the OdooBot notification in the systray as it depends on the navigator so display the alert message under users preference section. Related Task ID: 1929547 closes odoo/odoo#30496
Diffstat (limited to 'addons/mail_bot/static/src')
-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;
+
+});