1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/17343] Clean up code for webpush output

PHPBB-17343
This commit is contained in:
Marc Alexander
2024-10-02 22:06:43 +02:00
parent 73a06ef4df
commit 1ed5670afe
2 changed files with 19 additions and 16 deletions

View File

@@ -140,7 +140,10 @@ class webpush extends messenger_base implements extended_method_interface
{
$data = $notification->get_insert_array();
$data += [
'push_data' => json_encode(array_merge($notification->get_insert_array(), ['notification_type_name' => $notification->get_type()])),
'push_data' => json_encode(array_merge(
$data,
['notification_type_name' => $notification->get_type()],
)),
'notification_time' => time(),
'push_token' => hash('sha256', random_bytes(32))
];
@@ -345,6 +348,14 @@ class webpush extends messenger_base implements extended_method_interface
return array_intersect_key($data, $row);
}
/**
* Get template data for the UCP
*
* @param helper $controller_helper
* @param form_helper $form_helper
*
* @return array
*/
public function get_ucp_template_data(helper $controller_helper, form_helper $form_helper): array
{
$subscription_map = $this->get_user_subscription_map([$this->user->id()]);