[ticket/17333] Prevent double loading web push template data

PHPBB-17333

Signed-off-by: Matt Friedman <maf675@gmail.com>
This commit is contained in:
Matt Friedman 2024-06-04 14:19:37 -07:00
parent 0ca8524633
commit 73e0412c88
No known key found for this signature in database

View file

@ -3873,17 +3873,19 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
$template->assign_block_vars('notifications', $notification->prepare_for_display()); $template->assign_block_vars('notifications', $notification->prepare_for_display());
} }
// Get web push notification data // Assign notification web push template data (if not done already by ucp_notifications)
$methods = $phpbb_notifications->get_subscription_methods(); if ($config['webpush_dropdown_subscribe'] && $template->retrieve_var('NOTIFICATIONS_WEBPUSH_ENABLE') === null)
if ($config['webpush_dropdown_subscribe'] && array_key_exists('notification.method.webpush', $methods)) {
$methods = $phpbb_notifications->get_subscription_methods();
if (isset($methods['notification.method.webpush']))
{ {
/** @var \phpbb\form\form_helper $form_helper */
$form_helper = $phpbb_container->get('form_helper'); $form_helper = $phpbb_container->get('form_helper');
$template_ary = $methods['notification.method.webpush']['method']->get_ucp_template_data($controller_helper, $form_helper); $template_ary = $methods['notification.method.webpush']['method']->get_ucp_template_data($controller_helper, $form_helper);
$template->assign_vars($template_ary); $template->assign_vars($template_ary);
} }
} }
}
$notification_mark_hash = generate_link_hash('mark_all_notifications_read'); $notification_mark_hash = generate_link_hash('mark_all_notifications_read');