Skip to content

Commit 6ed1fb9

Browse files
authored
Merge pull request #44 from iMattPro/fixes
Reverse forcing wpn settings on users
2 parents b55ea73 + 068f8b4 commit 6ed1fb9

8 files changed

Lines changed: 5 additions & 125 deletions

File tree

event/listener.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public static function getSubscribedEvents()
3131
'core.ucp_display_module_before' => 'load_language',
3232
'core.acp_main_notice' => 'compatibility_notice',
3333
'core.page_header_after' => 'load_template_data',
34-
'core.user_add_modify_notifications_data' => 'add_user_notification_data',
3534
];
3635
}
3736

@@ -100,24 +99,4 @@ public function compatibility_notice()
10099
{
101100
$this->template->assign_var('S_WPN_COMPATIBILITY_NOTICE', phpbb_version_compare(PHPBB_VERSION, '4.0.0-dev', '>='));
102101
}
103-
104-
/**
105-
* Add default web push notification settings for new users
106-
*
107-
* @param \phpbb\event\data $event The event object
108-
* @return void
109-
*/
110-
public function add_user_notification_data($event)
111-
{
112-
$notifications_data = $event['notifications_data'];
113-
$notifications_data[] = [
114-
'item_type' => 'notification.type.quote',
115-
'method' => 'notification.method.phpbb.wpn.webpush',
116-
];
117-
$notifications_data[] = [
118-
'item_type' => 'notification.type.pm',
119-
'method' => 'notification.method.phpbb.wpn.webpush',
120-
];
121-
$event['notifications_data'] = $notifications_data;
122-
}
123102
}

language/en/webpushnotifications_module_ucp.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@
4545
'NOTIFY_WEBPUSH_SUBSCRIBE' => 'Subscribe',
4646
'NOTIFY_WEBPUSH_UNSUBSCRIBE' => 'Unsubscribe',
4747
'NOTIFY_WEBPUSH_SUBSCRIBED' => 'Subscribed',
48+
'NOTIFY_WEBPUSH_DROPDOWN_TITLE' => 'Visit notifications settings to set your preferred push notifications.',
4849
]);

language/ru/webpushnotifications_module_ucp.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@
4545
'NOTIFY_WEBPUSH_SUBSCRIBE' => 'Подписаться',
4646
'NOTIFY_WEBPUSH_UNSUBSCRIBE' => 'Отписаться',
4747
'NOTIFY_WEBPUSH_SUBSCRIBED' => 'Включено',
48+
'NOTIFY_WEBPUSH_DROPDOWN_TITLE' => 'Посетите настройки уведомлений, чтобы установить предпочтительные push-уведомления.',
4849
]);

migrations/update_user_notifications.php

Lines changed: 0 additions & 94 deletions
This file was deleted.

styles/all/template/event/notification_dropdown_footer_after.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{% if NOTIFICATIONS_WEBPUSH_ENABLE and not notification_types|default and not notification_list|default %}
2-
<div class="wpn-notification-dropdown-footer">
1+
{% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is not defined and notification_list is not defined %}
2+
<div class="wpn-notification-dropdown-footer" title="{{ lang('NOTIFY_WEBPUSH_DROPDOWN_TITLE') }}">
33
<span class="ellipsis-text">{{ lang('NOTIFY_WEBPUSH_ENABLE_SHORT') ~ lang('COLON') }}</span>
44
<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>
55
<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>

styles/prosilver/template/event/ucp_notifications_content_before.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% if NOTIFICATIONS_WEBPUSH_ENABLE %}
1+
{% if NOTIFICATIONS_WEBPUSH_ENABLE and notification_types is defined %}
22
<div class="panel">
33
<div class="inner">
44
<fieldset>

tests/event/listener_test.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ public function test_getSubscribedEvents()
125125
'core.ucp_display_module_before',
126126
'core.acp_main_notice',
127127
'core.page_header_after',
128-
'core.user_add_modify_notifications_data',
129128
], array_keys(\phpbb\webpushnotifications\event\listener::getSubscribedEvents()));
130129
}
131130

tests/functional/functional_test.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ public function test_ucp_module()
7272

7373
$this->assertContainsLang('NOTIFY_WEBPUSH_ENABLE', $crawler->filter('label[for="subscribe_webpush"]')->text());
7474
$this->assertContainsLang('NOTIFICATION_METHOD_PHPBB_WPN_WEBPUSH', $crawler->filter('th.mark')->eq(2)->text());
75-
76-
$wp_list = $crawler->filter('.table1');
77-
$this->assert_checkbox_is_checked($wp_list, 'notification.type.quote_notification.method.phpbb.wpn.webpush');
78-
$this->assert_checkbox_is_checked($wp_list, 'notification.type.pm_notification.method.phpbb.wpn.webpush');
79-
$this->assert_checkbox_is_unchecked($wp_list, 'notification.type.bookmark_notification.method.phpbb.wpn.webpush');
80-
$this->assert_checkbox_is_unchecked($wp_list, 'notification.type.group_request_notification.method.phpbb.wpn.webpush');
8175
}
8276

8377
public function test_dropdown_subscribe_button()

0 commit comments

Comments
 (0)