1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-01 14:30:32 +02:00

Merge pull request #6632 from iMattPro/ticket/17333

[ticket/17333] UX Enhancements for Web Push Subscribing
This commit is contained in:
Marc Alexander
2024-06-07 20:11:13 +02:00
committed by GitHub
14 changed files with 241 additions and 7 deletions

View File

@@ -494,6 +494,8 @@ class acp_board
'webpush_enable' => ['lang' => 'WEBPUSH_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'webpush_enable', 'explain' => true],
'webpush_vapid_public' => ['lang' => 'WEBPUSH_VAPID_PUBLIC', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true],
'webpush_vapid_private' => ['lang' => 'WEBPUSH_VAPID_PRIVATE', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true],
'webpush_method_default_enable' => ['lang' => 'WEBPUSH_METHOD_DEFAULT_ENABLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
'webpush_dropdown_subscribe' => ['lang' => 'WEBPUSH_DROPDOWN_SUBSCRIBE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true],
'legend3' => 'ACP_SUBMIT_CHANGES',
],

View File

@@ -3735,6 +3735,9 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
$timezone_name = $user->lang['timezones'][$timezone_name];
}
/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');
// Output the notifications
$notifications = false;
if ($config['load_notifications'] && $config['allow_board_notifications'] && $user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_IGNORE)
@@ -3751,10 +3754,22 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
{
$template->assign_block_vars('notifications', $notification->prepare_for_display());
}
// Assign web push template vars globally (if not done already by ucp_notifications) for the dropdown subscribe button
if ($config['webpush_enable'] && $config['webpush_dropdown_subscribe']
&& $template->retrieve_var('NOTIFICATIONS_WEBPUSH_ENABLE') === null)
{
$methods = $phpbb_notifications->get_subscription_methods();
$webpush = $methods['notification.method.webpush'] ?? null;
if ($webpush)
{
$form_helper = $phpbb_container->get('form_helper');
$template->assign_vars($webpush['method']->get_ucp_template_data($controller_helper, $form_helper));
}
}
}
/** @var \phpbb\controller\helper $controller_helper */
$controller_helper = $phpbb_container->get('controller.helper');
$notification_mark_hash = generate_link_hash('mark_all_notifications_read');
$phpbb_version_parts = explode('.', PHPBB_VERSION, 3);