Skip to content

Commit

Permalink
Show message is site previously denied notifications
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Friedman <[email protected]>

Fix

Signed-off-by: Matt Friedman <[email protected]>
  • Loading branch information
iMattPro committed Jun 15, 2024
1 parent ad9bb9e commit 14780d3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions language/en/webpushnotifications_module_ucp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 to subscribe to this site.',
]);
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is not defined %}
<div class="wpn-notification-dropdown-footer" title="{{ lang('NOTIFY_WEBPUSH_DROPDOWN_TITLE') }}">
<span class="ellipsis-text">{{ lang('NOTIFY_WEBPUSH_ENABLE_SHORT') ~ lang('COLON') }}</span>
<button id="subscribe_webpush" name="subscribe_webpush"><i class="icon fa-toggle-off fa-fw icon-lightgray"></i><span>{{ lang('NOTIFY_WEBPUSH_SUBSCRIBE') }}</span></button>
<button id="unsubscribe_webpush" name="unsubscribe_webpush" class="hidden"><i class="icon fa-toggle-on fa-fw icon-blue"></i><span>{{ lang('NOTIFY_WEBPUSH_SUBSCRIBED') }}</span></button>
<button id="subscribe_webpush" name="subscribe_webpush" data-wpn-denied-title="{{ lang('NOTIFY_WEBPUSH_SUB_DENIED') }}" data-wpn-denied-msg="{{ lang('NOTIFY_WEBPUSH_SUB_DENIED_MSG') }}">
<i class="icon fa-toggle-off fa-fw icon-lightgray"></i><span>{{ lang('NOTIFY_WEBPUSH_SUBSCRIBE') }}</span>
</button>
<button id="unsubscribe_webpush" name="unsubscribe_webpush" class="hidden">
<i class="icon fa-toggle-on fa-fw icon-blue"></i><span>{{ lang('NOTIFY_WEBPUSH_SUBSCRIBED') }}</span>
</button>
</div>
{% endif %}
1 change: 1 addition & 0 deletions styles/all/template/webpush.js
Original file line number Diff line number Diff line change
Expand Up @@ -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-wpn-denied-title'), subscribeButton.getAttribute('data-wpn-denied-msg'));
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<dl>
<dt><label for="subscribe_webpush">{{ lang('NOTIFY_WEBPUSH_ENABLE') ~ lang('COLON') }}</label><br><span>{{ lang('NOTIFY_WEBPUSH_ENABLE_EXPLAIN') }}</span></dt>
<dd>
<input id="subscribe_webpush" type="submit" name="subscribe_webpush" value="{{ lang('NOTIFY_WEBPUSH_SUBSCRIBE') }}" class="button1 button button-form">
<input id="subscribe_webpush" type="submit" name="subscribe_webpush" value="{{ lang('NOTIFY_WEBPUSH_SUBSCRIBE') }}" class="button1 button button-form" data-wpn-denied-title="{{ lang('NOTIFY_WEBPUSH_SUB_DENIED') }}" data-wpn-denied-msg="{{ lang('NOTIFY_WEBPUSH_SUB_DENIED_MSG') }}">
<input id="unsubscribe_webpush" type="submit" name="unsubscribe_webpush" value="{{ lang('NOTIFY_WEBPUSH_UNSUBSCRIBE') }}" class="button1 button button-form hidden">
</dd>
</dl>
Expand Down

0 comments on commit 14780d3

Please sign in to comment.