From 17edf6712da8b59c909f6dd7bf1e483cdbf20246 Mon Sep 17 00:00:00 2001 From: Julien Banken Date: Thu, 1 Apr 2021 11:47:17 +0000 Subject: [PATCH] [IMP] website_event_track: ask for notifications when favoriting a track PURPOSE When a user adds a track to his/her favorites, we really want to make sure that the notifications are activated so that he/she can be notified when a track is about to start. The "Set Favorite" button of the tracks will now propagate a new event that will notify the notification manager that a new push notification request should be issued immediately. SPECS - Trigger a new event when the user adds a tracks to his/her favorite. LINKS Task-2347597 COM PR odoo/odoo#69102 ENT PR odoo/enterprise#17612 X-original-commit: 0e28bfdea3938b1d76cb62223b84f155a6ce75d7 --- .../static/src/js/event_track_reminder.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/website_event_track/static/src/js/event_track_reminder.js b/addons/website_event_track/static/src/js/event_track_reminder.js index cae10488b9f..1e3c97a90b1 100644 --- a/addons/website_event_track/static/src/js/event_track_reminder.js +++ b/addons/website_event_track/static/src/js/event_track_reminder.js @@ -63,6 +63,13 @@ publicWidget.registry.websiteEventTrackReminder = publicWidget.Widget.extend({ type: 'info', title: message }); + if (self.reminderOn) { + core.bus.trigger('open_notification_request', 'add_track_to_favorite', { + title: _t('Allow push notifications?'), + body: _t('You have to enable push notifications to get reminders for your favorite tracks.'), + delay: 0 + }); + } } if (result.visitor_uuid) { utils.set_cookie('visitor_uuid', result.visitor_uuid);