From 0fc1a8c1f8c1d7a2781644857ebb58db489c4137 Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 16 Jun 2024 08:49:36 -0700 Subject: [PATCH 1/3] [ticket/17344] Show an alert when webpush subscribing is denied PHPBB-17344 --- phpBB/assets/javascript/webpush.js | 1 + phpBB/language/en/common.php | 1 + phpBB/styles/prosilver/template/notification_dropdown.html | 2 +- phpBB/styles/prosilver/template/ucp_notifications_options.html | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/assets/javascript/webpush.js b/phpBB/assets/javascript/webpush.js index c326fe1cff..94e542d2ae 100644 --- a/phpBB/assets/javascript/webpush.js +++ b/phpBB/assets/javascript/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/phpBB/language/en/common.php b/phpBB/language/en/common.php index 5933cc8f5c..43269679bf 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -515,6 +515,7 @@ $lang = array_merge($lang, array( 'NOTIFY_WEB_PUSH_ENABLE' => 'Enable Web Push notifications', 'NOTIFY_WEB_PUSH_SUBSCRIBE' => 'Subscribe', 'NOTIFY_WEB_PUSH_SUBSCRIBED'=> 'Subscribed', + 'NOTIFY_WEB_PUSH_DENIED' => 'You have denied notifications from this site. To subscribe, please allow notifications in your browser settings.', 'NO_ACCESS_ATTACHMENT' => 'You are not allowed to access this file.', 'NO_ACTION' => 'No action specified.', 'NO_ADMINISTRATORS' => 'There are no administrators.', diff --git a/phpBB/styles/prosilver/template/notification_dropdown.html b/phpBB/styles/prosilver/template/notification_dropdown.html index ff52543d0a..abd5c85bfd 100644 --- a/phpBB/styles/prosilver/template/notification_dropdown.html +++ b/phpBB/styles/prosilver/template/notification_dropdown.html @@ -47,7 +47,7 @@ {% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is not defined %} {% endif %} diff --git a/phpBB/styles/prosilver/template/ucp_notifications_options.html b/phpBB/styles/prosilver/template/ucp_notifications_options.html index b3be983f16..27981581ff 100644 --- a/phpBB/styles/prosilver/template/ucp_notifications_options.html +++ b/phpBB/styles/prosilver/template/ucp_notifications_options.html @@ -10,7 +10,7 @@

{{ lang('NOTIFY_WEBPUSH_ENABLE_EXPLAIN') }}
- +
From f3ca92ffe78b832ac9f39633d5422520bb87fa6e Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 16 Jun 2024 09:01:39 -0700 Subject: [PATCH 2/3] [ticket/17344] Responsive mobile friendly webpush sub button PHPBB-17344 --- phpBB/styles/prosilver/theme/common.css | 1 + phpBB/styles/prosilver/theme/responsive.css | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 2300f9c611..f679df7c9f 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -1347,6 +1347,7 @@ ul.linklist:after, flex-wrap: nowrap; justify-content: space-between; padding: 5px 10px; + gap: 20px; } .notification-avatar, diff --git a/phpBB/styles/prosilver/theme/responsive.css b/phpBB/styles/prosilver/theme/responsive.css index 5deb7224a6..481b1a23d3 100644 --- a/phpBB/styles/prosilver/theme/responsive.css +++ b/phpBB/styles/prosilver/theme/responsive.css @@ -20,6 +20,16 @@ } } +@media (max-width: 550px) { + .dropdown-extended .notification-dropdown-footer .notification-subscribe_toggle > span { + display: none; + } + + .dropdown-extended .notification-dropdown-footer .notification-subscribe_toggle > .icon { + font-size: 24px; + } +} + @media (max-width: 430px) { .action-bar .search-box .inputbox { width: 120px; From 16743e934523078b2020b1a975f157900fc1e7ae Mon Sep 17 00:00:00 2001 From: Matt Friedman Date: Sun, 16 Jun 2024 09:43:02 -0700 Subject: [PATCH 3/3] [ticket/17344] Improve webpush class names PHPBB-17344 --- .../prosilver/template/notification_dropdown.html | 6 +++--- phpBB/styles/prosilver/theme/buttons.css | 2 +- phpBB/styles/prosilver/theme/colours.css | 6 +++++- phpBB/styles/prosilver/theme/common.css | 3 +-- phpBB/styles/prosilver/theme/responsive.css | 8 +------- tests/functional/notification_webpush_test.php | 10 +++++----- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/phpBB/styles/prosilver/template/notification_dropdown.html b/phpBB/styles/prosilver/template/notification_dropdown.html index abd5c85bfd..de5a8c79e6 100644 --- a/phpBB/styles/prosilver/template/notification_dropdown.html +++ b/phpBB/styles/prosilver/template/notification_dropdown.html @@ -45,10 +45,10 @@ {L_SEE_ALL} {% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is not defined %} -