mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/17344] Show an alert when webpush subscribing is denied
PHPBB-17344
This commit is contained in:
parent
5992eff175
commit
0fc1a8c1f8
4 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.',
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
{% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is not defined %}
|
||||
<div class="notification-dropdown-footer">
|
||||
<span class="ellipsis-text">{{ lang('NOTIFY_WEB_PUSH_ENABLE') ~ lang('COLON') }}</span>
|
||||
<button id="subscribe_webpush" name="subscribe_webpush" class="notification-subscribe_toggle">{{ Icon('font', 'toggle-off', lang('NOTIFY_WEB_PUSH_SUBSCRIBE'), false, '', {'style' : 'color:#9e9e9e;'}) }}</button>
|
||||
<button id="subscribe_webpush" name="subscribe_webpush" class="notification-subscribe_toggle" data-l-err="{{ lang('INFORMATION') }}" data-l-msg="{{ lang('NOTIFY_WEB_PUSH_DENIED') }}">{{ Icon('font', 'toggle-off', lang('NOTIFY_WEB_PUSH_SUBSCRIBE'), false, '', {'style' : 'color:#9e9e9e;'}) }}</button>
|
||||
<button id="unsubscribe_webpush" name="unsubscribe_webpush" class="notification-subscribe_toggle hidden">{{ Icon('font', 'toggle-on', lang('NOTIFY_WEB_PUSH_SUBSCRIBED'), false, '', {'style' : 'color:#0059b3;'}) }}</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -10,7 +10,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('INFORMATION') }}" data-l-msg="{{ lang('NOTIFY_WEB_PUSH_DENIED') }}">
|
||||
<input id="unsubscribe_webpush" type="submit" name="unsubscribe_webpush" value="{{ lang('NOTIFY_WEBPUSH_UNSUBSCRIBE') }}" class="button1 button button-form hidden">
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
Loading…
Add table
Reference in a new issue