Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show message when notifications are denied #58

Merged
merged 2 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if just usual "Information" is enough in popup title.

'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.',
]);
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-l-err="{{ lang('NOTIFY_WEBPUSH_SUB_DENIED') }}" data-l-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-l-err'), subscribeButton.getAttribute('data-l-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-l-err="{{ lang('NOTIFY_WEBPUSH_SUB_DENIED') }}" data-l-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
Loading