Skip to content

Commit 3eff72d

Browse files
authored
Merge pull request #61 from iMattPro/funstuff
Design changes
2 parents adc7580 + 3df3448 commit 3eff72d

11 files changed

Lines changed: 80 additions & 38 deletions

.github/workflows/tests.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ jobs:
125125
db: "mysql:5.7"
126126
- php: '8.3'
127127
db: "mysql:5.7"
128+
- php: '8.4'
129+
db: "mysql:5.7"
128130

129131
name: PHP ${{ matrix.php }} - ${{ matrix.db_alias != '' && matrix.db_alias || matrix.db }}
130132

@@ -247,6 +249,8 @@ jobs:
247249
db: "postgres:14"
248250
- php: '8.3'
249251
db: "postgres:14"
252+
- php: '8.4'
253+
db: "postgres:14"
250254

251255
name: PHP ${{ matrix.php }} - ${{ matrix.db }}
252256

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ Testing push notifications necessitates user-to-user interactions to observe the
3737

3838
1. **User Account Setup:**
3939
- Create at least two distinct user accounts for testing purposes.
40-
- In user1's account notifications preferences, assign web push notifications and subscribe to receive Push Notifications.
40+
- In the notifications preferences for _**User Account 1**_, subscribe to receive Push Notifications (and assign web push notification types if necessary).
4141

4242
2. **Message, Quote, or Reply Interaction:**
43-
- Initiate a user-to-user interaction by performing one of the following actions using "User Account 2":
44-
- **Private Message:** Send a direct message from "User Account 2" to "User Account 1".
45-
- **Quote:** Quote a post or message authored by "User Account 1" using "User Account 2".
46-
- **Reply:** Respond to a post or message authored by "User Account 1" using "User Account 2".
43+
- Initiate a user-to-user interaction by performing one of the following actions using _**User Account 2**_:
44+
- **Private Message:** Send a direct message from _**User Account 2**_ to _**User Account 1**_.
45+
- **Quote:** Quote a post or message authored by _**User Account 1**_ using _**User Account 2**_.
46+
- **Reply:** Respond to a post or message authored by _**User Account 1**_ using _**User Account 2**_.
4747

4848
3. **Observing Push Notifications:**
49-
- Once the interaction is performed from "User Account 2" to engage with "User Account 1," you promptly should see a notification for "User Account 1."
49+
- Once the interaction is performed from _**User Account 2**_ to engage with _**User Account 1**_, you promptly should see a notification for _**User Account 1**_.
5050

5151
4. **Caveats for Local Testing**
5252
- Local testing of Push Notifications only works from a `localhost` address or if your local server has a secure SSL certificate.

acp/wpn_acp_module.php

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ public function display_settings()
105105
'S_WEBPUSH_METHOD_ENABLED' => $this->config['wpn_webpush_method_enabled'],
106106
'U_ACTION' => $this->u_action,
107107
]);
108+
109+
if (!$this->request->server('HTTPS', false) && $this->request->server('SERVER_NAME') !== 'localhost')
110+
{
111+
$this->errors[] = $this->lang->lang('WEBPUSH_INSECURE_SERVER_ERROR');
112+
}
113+
114+
$this->display_errors();
108115
}
109116

110117
/**
@@ -135,13 +142,8 @@ public function save_settings()
135142
validate_config_vars($display_settings, $config_array, $this->errors);
136143
}
137144

138-
if (count($this->errors))
145+
if ($this->display_errors())
139146
{
140-
$this->template->assign_vars([
141-
'S_ERROR' => (bool) count($this->errors),
142-
'ERROR_MSG' => implode('<br>', $this->errors),
143-
]);
144-
145147
return;
146148
}
147149

@@ -154,4 +156,21 @@ public function save_settings()
154156

155157
trigger_error($this->lang->lang('CONFIG_UPDATED') . adm_back_link($this->u_action), E_USER_NOTICE);
156158
}
159+
160+
/**
161+
* Display any errors
162+
*
163+
* @return bool
164+
*/
165+
public function display_errors()
166+
{
167+
$has_errors = (bool) count($this->errors);
168+
169+
$this->template->assign_vars([
170+
'S_ERROR' => $has_errors,
171+
'ERROR_MSG' => $has_errors ? implode('<br>', $this->errors) : '',
172+
]);
173+
174+
return $has_errors;
175+
}
157176
}

language/en/webpushnotifications_module_acp.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@
5050
'WEBPUSH_METHOD_ENABLED_EXPLAIN'=> 'When this setting is enabled, users who subscribe and allow browser notifications will start receiving them automatically. They only need to visit the UCP Notification settings to disable any unwanted notifications.<br><br>If this setting is disabled, users will not receive any notifications, even if they have subscribed, until they visit the UCP Notification settings to enable the specific notifications they wish to receive.',
5151
'WEBPUSH_DROPDOWN_SUBSCRIBE' => 'Show “Subscribe” button in notification dropdown',
5252
'WEBPUSH_DROPDOWN_SUBSCRIBE_EXPLAIN'=> 'Enable or disable the “Subscribe” button in the Notification dropdown, allowing users to easily subscribe to push notifications from any page of the forum.',
53+
'WEBPUSH_INSECURE_SERVER_ERROR' => 'This board is not using a secure SSL/HTTPS server protocol, which is required to enable and use web push notifications.',
5354
]);

language/en/webpushnotifications_module_ucp.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939

4040
$lang = array_merge($lang, [
4141
'NOTIFICATION_METHOD_PHPBB_WPN_WEBPUSH' => 'Web Push',
42-
'NOTIFY_WEBPUSH_ENABLE_SHORT' => 'Enable Web Push notifications',
43-
'NOTIFY_WEBPUSH_ENABLE' => 'Enable receiving Web Push notifications',
44-
'NOTIFY_WEBPUSH_ENABLE_EXPLAIN' => 'Enable receiving browser-based push notifications.<br>The notifications can be turned off at any time in your browser settings, by unsubscribing, or by disabling the push notifications below.',
42+
'NOTIFY_WEBPUSH_NOTIFICATIONS' => 'Web Push Notifications',
43+
'NOTIFY_WEBPUSH_DISABLE' => 'Disable Push Notifications',
44+
'NOTIFY_WEBPUSH_ENABLE' => 'Enable Push Notifications',
45+
'NOTIFY_WEBPUSH_ENABLE_EXPLAIN' => 'Enabling push notifications will activate them on this device only. You can turn off notifications at any time through your browser settings or by clicking the button above. Additionally, if no web push notification types are selected below, you will not receive any web push notifications.',
4546
'NOTIFY_WEBPUSH_SUBSCRIBE' => 'Subscribe',
4647
'NOTIFY_WEBPUSH_UNSUBSCRIBE' => 'Unsubscribe',
47-
'NOTIFY_WEBPUSH_SUBSCRIBED' => 'Subscribed',
4848
'NOTIFY_WEBPUSH_DROPDOWN_TITLE' => 'Visit notifications settings to set your preferred push notifications.',
4949
'NOTIFY_WEBPUSH_DENIED' => 'You have denied notifications from this site. To subscribe, please allow notifications in your browser settings.',
5050
]);

language/ru/webpushnotifications_module_acp.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@
5050
'WEBPUSH_METHOD_ENABLED_EXPLAIN'=> 'Если включено, то пользователи, подписавшиеся на браузерные push—уведомления, будут автоматически получать все их типы. Если отключено, то пользователи не будут получать браузерные push—уведомления до тех пор, пока хотя бы один их тип не выбран.<br><br>Отключить нежелательные или выбрать нужные типы браузерных push—уведомлений можно в настройках уведомлений в Личном разделе.',
5151
'WEBPUSH_DROPDOWN_SUBSCRIBE' => 'Показать кнопку «Подписаться» в выпадающем меню уведомлений',
5252
'WEBPUSH_DROPDOWN_SUBSCRIBE_EXPLAIN'=> 'Включить или отключить отображение кнопки «Подписаться» в выпадающем списке уведомлений. Если включено, то пользователи смогут подписываться на браузерные push-уведомления с любой страницы конференции.',
53+
'WEBPUSH_INSECURE_SERVER_ERROR' => 'Эта доска не использует защищенный протокол SSL/HTTPS, который необходим для включения и использования веб-уведомлений.',
5354
]);

language/ru/webpushnotifications_module_ucp.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939

4040
$lang = array_merge($lang, [
4141
'NOTIFICATION_METHOD_PHPBB_WPN_WEBPUSH' => 'Браузерные',
42-
'NOTIFY_WEBPUSH_ENABLE_SHORT' => 'Браузерные уведомления',
43-
'NOTIFY_WEBPUSH_ENABLE' => 'Включить браузерные push—уведомления',
44-
'NOTIFY_WEBPUSH_ENABLE_EXPLAIN' => 'Включение возможности получения браузерных push—уведомлений.<br>Данная возможность может быть отключена в любое время в настройках браузера, с помощью кнопки «Отписаться» или путём отключения типов уведомлений в категории «Браузерные» ниже.',
42+
'NOTIFY_WEBPUSH_NOTIFICATIONS' => 'Веб-уведомления',
43+
'NOTIFY_WEBPUSH_DISABLE' => 'Отключить веб-уведомления',
44+
'NOTIFY_WEBPUSH_ENABLE' => 'Браузерные уведомления',
45+
'NOTIFY_WEBPUSH_ENABLE_EXPLAIN' => 'Включение веб-уведомлений активирует их только на этом устройстве. Вы можете отключить уведомления в любое время через настройки браузера или нажав на кнопку выше. Кроме того, если ниже не выбрано ни одного типа веб-уведомлений, вы не будете получать никаких веб-уведомлений.',
4546
'NOTIFY_WEBPUSH_SUBSCRIBE' => 'Подписаться',
4647
'NOTIFY_WEBPUSH_UNSUBSCRIBE' => 'Отписаться',
47-
'NOTIFY_WEBPUSH_SUBSCRIBED' => 'Включено',
4848
'NOTIFY_WEBPUSH_DROPDOWN_TITLE' => 'Посетите настройки уведомлений, чтобы установить предпочтительные типы браузерных уведомлений.',
4949
'NOTIFY_WEBPUSH_DENIED' => 'Вы запретили браузерные уведомления для даного сайта. Для того, чтобы подписаться, необходимо их разрешить в настройках браузера.',
5050
]);
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is not defined %}
22
<div class="wpn-notification-dropdown-footer" title="{{ lang('NOTIFY_WEBPUSH_DROPDOWN_TITLE') }}">
3-
<span class="ellipsis-text">{{ lang('NOTIFY_WEBPUSH_ENABLE_SHORT') ~ lang('COLON') }}</span>
3+
<span class="ellipsis-text">{{ lang('NOTIFY_WEBPUSH_ENABLE') ~ lang('COLON') }}</span>
44
<button id="subscribe_webpush" name="subscribe_webpush" data-l-err="{{ lang('INFORMATION') }}" data-l-msg="{{ lang('NOTIFY_WEBPUSH_DENIED') }}">
5-
<i class="icon fa-toggle-off fa-fw icon-lightgray"></i><span>{{ lang('NOTIFY_WEBPUSH_SUBSCRIBE') }}</span>
5+
<i class="icon fa-toggle-off fa-fw icon-lightgray" aria-hidden="true" title="{{ lang('NOTIFY_WEBPUSH_SUBSCRIBE') }}"><span class="sr-only">{{ lang('NOTIFY_WEBPUSH_SUBSCRIBE') }}</span></i>
66
</button>
77
<button id="unsubscribe_webpush" name="unsubscribe_webpush" class="hidden">
8-
<i class="icon fa-toggle-on fa-fw icon-blue"></i><span>{{ lang('NOTIFY_WEBPUSH_SUBSCRIBED') }}</span>
8+
<i class="icon fa-toggle-on fa-fw icon-blue" aria-hidden="true" title="{{ lang('NOTIFY_WEBPUSH_UNSUBSCRIBE') }}"><span class="sr-only">{{ lang('NOTIFY_WEBPUSH_UNSUBSCRIBE') }}</span></i>
99
</button>
1010
</div>
1111
{% endif %}

styles/all/theme/phpbb_wpn.css

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
.button[disabled],
2-
.button[disabled]:hover,
3-
.button.disabled,
4-
.button.disabled:hover {
1+
.wpn.button[disabled],
2+
.wpn.button[disabled]:hover,
3+
.wpn.button.disabled,
4+
.wpn.button.disabled:hover {
55
background: #e0e0e0;
66
border-color: #9e9e9e;
77
color: #9e9e9e;
88
}
99

10-
.button.hidden {
10+
.wpn.button.hidden,
11+
.wpn-notification-dropdown-footer button.hidden {
1112
display: none;
1213
}
1314

15+
.wpn.button {
16+
margin: 0 0 8px;
17+
}
18+
1419
.wpn-notification-dropdown-footer {
1520
font-size: 12px;
1621
white-space: nowrap;
@@ -22,16 +27,27 @@
2227
gap: 20px;
2328
}
2429

30+
.wpn-notification-dropdown-footer button {
31+
display: inline-flex;
32+
align-items: center;
33+
}
34+
2535
.wpn-notification-dropdown-footer button:disabled {
2636
opacity: 0.7;
2737
}
2838

29-
@media only screen and (max-width: 550px), only screen and (max-device-width: 550px) {
30-
.wpn-notification-dropdown-footer button > span {
31-
display: none;
32-
}
39+
.wpn-notification-dropdown-footer button > .icon {
40+
font-size: 20px;
41+
}
3342

43+
@media only screen and (max-width: 350px), only screen and (max-device-width: 350px) {
3444
.wpn-notification-dropdown-footer button > .icon {
3545
font-size: 24px;
3646
}
3747
}
48+
49+
@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) {
50+
.wpn.button {
51+
margin-top: 8px;
52+
}
53+
}

styles/prosilver/template/event/ucp_notifications_content_before.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
<div class="inner">
44
<fieldset>
55
<dl>
6-
<dt><label for="subscribe_webpush">{{ lang('NOTIFY_WEBPUSH_ENABLE') ~ lang('COLON') }}</label><br><span>{{ lang('NOTIFY_WEBPUSH_ENABLE_EXPLAIN') }}</span></dt>
6+
<dt><label for="subscribe_webpush">{{ lang('NOTIFY_WEBPUSH_NOTIFICATIONS') ~ lang('COLON') }}</label></dt>
77
<dd>
8-
<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_WEBPUSH_DENIED') }}">
9-
<input id="unsubscribe_webpush" type="submit" name="unsubscribe_webpush" value="{{ lang('NOTIFY_WEBPUSH_UNSUBSCRIBE') }}" class="button1 button button-form hidden">
8+
<input id="subscribe_webpush" type="submit" name="subscribe_webpush" value="{{ lang('NOTIFY_WEBPUSH_ENABLE') }}" class="wpn button1 button button-form" data-l-err="{{ lang('INFORMATION') }}" data-l-msg="{{ lang('NOTIFY_WEBPUSH_DENIED') }}">
9+
<input id="unsubscribe_webpush" type="submit" name="unsubscribe_webpush" value="{{ lang('NOTIFY_WEBPUSH_DISABLE') }}" class="wpn button1 button button-form hidden">
10+
<br><span>{{ lang('NOTIFY_WEBPUSH_ENABLE_EXPLAIN') }}</span>
1011
</dd>
1112
</dl>
1213
</fieldset>

0 commit comments

Comments
 (0)