From fdef7d331c191f65204b8c0de42137ebd8aa9407 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 15 Jun 2024 11:11:34 -0700 Subject: [PATCH 1/2] Show message is site previously denied notifications Signed-off-by: Matt Friedman Fix Signed-off-by: Matt Friedman fix Signed-off-by: Matt Friedman fix Signed-off-by: Matt Friedman --- language/en/webpushnotifications_module_ucp.php | 2 ++ .../event/notification_dropdown_footer_after.html | 8 ++++++-- styles/all/template/webpush.js | 1 + .../template/event/ucp_notifications_content_before.html | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/language/en/webpushnotifications_module_ucp.php b/language/en/webpushnotifications_module_ucp.php index 716c52d..93a592b 100644 --- a/language/en/webpushnotifications_module_ucp.php +++ b/language/en/webpushnotifications_module_ucp.php @@ -46,4 +46,6 @@ 'NOTIFY_WEBPUSH_UNSUBSCRIBE' => 'Unsubscribe', 'NOTIFY_WEBPUSH_SUBSCRIBED' => 'Subscribed', 'NOTIFY_WEBPUSH_DROPDOWN_TITLE' => 'Visit notifications settings to set your preferred push notifications.', + 'NOTIFY_WEBPUSH_SUB_DENIED' => 'Push Notifications Are Denied', + 'NOTIFY_WEBPUSH_SUB_DENIED_MSG' => 'You have denied push notifications from this site. You must allow notifications from this site in your browser settings in order to subscribe to this site.', ]); diff --git a/styles/all/template/event/notification_dropdown_footer_after.html b/styles/all/template/event/notification_dropdown_footer_after.html index d4d1889..7b48f59 100644 --- a/styles/all/template/event/notification_dropdown_footer_after.html +++ b/styles/all/template/event/notification_dropdown_footer_after.html @@ -1,7 +1,11 @@ {% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is not defined %} {% endif %} diff --git a/styles/all/template/webpush.js b/styles/all/template/webpush.js index c326fe1..94e542d 100644 --- a/styles/all/template/webpush.js +++ b/styles/all/template/webpush.js @@ -150,6 +150,7 @@ function PhpbbWebpush() { // Prevent the user from clicking the subscribe button multiple times. const result = await Notification.requestPermission(); if (result === 'denied') { + phpbb.alert(subscribeButton.getAttribute('data-l-err'), subscribeButton.getAttribute('data-l-msg')); return; } diff --git a/styles/prosilver/template/event/ucp_notifications_content_before.html b/styles/prosilver/template/event/ucp_notifications_content_before.html index 2f159d6..7071422 100644 --- a/styles/prosilver/template/event/ucp_notifications_content_before.html +++ b/styles/prosilver/template/event/ucp_notifications_content_before.html @@ -5,7 +5,7 @@

{{ lang('NOTIFY_WEBPUSH_ENABLE_EXPLAIN') }}
- +
From bc9f7624222858923b776564b034501e2d3f8e68 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sat, 15 Jun 2024 21:14:45 -0700 Subject: [PATCH 2/2] Language updates Signed-off-by: Matt Friedman --- language/en/webpushnotifications_module_ucp.php | 3 +-- language/ru/webpushnotifications_module_ucp.php | 2 ++ .../all/template/event/notification_dropdown_footer_after.html | 2 +- .../template/event/ucp_notifications_content_before.html | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/language/en/webpushnotifications_module_ucp.php b/language/en/webpushnotifications_module_ucp.php index 93a592b..abc9cd7 100644 --- a/language/en/webpushnotifications_module_ucp.php +++ b/language/en/webpushnotifications_module_ucp.php @@ -46,6 +46,5 @@ 'NOTIFY_WEBPUSH_UNSUBSCRIBE' => 'Unsubscribe', 'NOTIFY_WEBPUSH_SUBSCRIBED' => 'Subscribed', 'NOTIFY_WEBPUSH_DROPDOWN_TITLE' => 'Visit notifications settings to set your preferred push notifications.', - 'NOTIFY_WEBPUSH_SUB_DENIED' => 'Push Notifications Are Denied', - 'NOTIFY_WEBPUSH_SUB_DENIED_MSG' => 'You have denied push notifications from this site. You must allow notifications from this site in your browser settings in order to subscribe to this site.', + 'NOTIFY_WEBPUSH_DENIED' => 'You have denied notifications from this site. To subscribe, please allow notifications in your browser settings.', ]); diff --git a/language/ru/webpushnotifications_module_ucp.php b/language/ru/webpushnotifications_module_ucp.php index efbb6b5..61cf1d9 100644 --- a/language/ru/webpushnotifications_module_ucp.php +++ b/language/ru/webpushnotifications_module_ucp.php @@ -46,4 +46,6 @@ 'NOTIFY_WEBPUSH_UNSUBSCRIBE' => 'Отписаться', 'NOTIFY_WEBPUSH_SUBSCRIBED' => 'Включено', 'NOTIFY_WEBPUSH_DROPDOWN_TITLE' => 'Посетите настройки уведомлений, чтобы установить предпочтительные push-уведомления.', + 'NOTIFY_WEBPUSH_DENIED' => 'Вы запретили браузерные уведомления для даного сайта. Для того, чтобы подписаться, необходимо их разрешить в настройках браузера.', + ]); diff --git a/styles/all/template/event/notification_dropdown_footer_after.html b/styles/all/template/event/notification_dropdown_footer_after.html index 7b48f59..8b76bf4 100644 --- a/styles/all/template/event/notification_dropdown_footer_after.html +++ b/styles/all/template/event/notification_dropdown_footer_after.html @@ -1,7 +1,7 @@ {% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is not defined %}