[ticket/17010] Add column for user push subscriptions

PHPBB3-17010
This commit is contained in:
Marc Alexander 2022-08-31 20:06:07 +02:00
parent 1c64c695a9
commit 83cf915758
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
2 changed files with 8 additions and 3 deletions

View file

@ -44,6 +44,13 @@ class add_webpush extends migration
'PRIMARY_KEY' => ['notification_type_id', 'item_id', 'item_parent_id', 'user_id'], 'PRIMARY_KEY' => ['notification_type_id', 'item_id', 'item_parent_id', 'user_id'],
], ],
], ],
'add_columns' => [
$this->table_prefix . 'users' => [
'COLUMNS' => [
'user_push_subscriptions' => ['MTEXT_UNI', '']
],
],
],
]; ];
} }

View file

@ -168,17 +168,15 @@ class webpush extends \phpbb\notification\method\messenger_base
// add actual web push data // add actual web push data
$data['data'] = [ $data['data'] = [
'title' => $this->config['sitename'],
'body' => $notification->get_title(), 'body' => $notification->get_title(),
'icon' => '', // @todo: to be filled? 'icon' => '', // @todo: to be filled?
'image' => '', // @todo: to be filled? 'image' => '', // @todo: to be filled?
'title' => $this->config['sitename'],
'url' => $notification->get_url(), 'url' => $notification->get_url(),
'user_id' => $notification->user_id, 'user_id' => $notification->user_id,
]; ];
$json_data = json_encode($data); $json_data = json_encode($data);
// @todo: start implementing actual web push code
foreach ($user_subscriptions as $subscription) foreach ($user_subscriptions as $subscription)
{ {
try try