mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
[ticket/17339] Support receiving push notifications if not logged in
PHPBB-17339
This commit is contained in:
@@ -23,12 +23,16 @@ self.addEventListener('push', event => {
|
||||
|
||||
let itemId = 0;
|
||||
let typeId = 0;
|
||||
let notificationVersion = 5;
|
||||
let userId = 0;
|
||||
let notificationVersion = 0;
|
||||
let pushToken = '';
|
||||
try {
|
||||
const notificationData = event.data.json();
|
||||
itemId = notificationData.item_id;
|
||||
typeId = notificationData.type_id;
|
||||
userId = notificationData.user_id;
|
||||
notificationVersion = parseInt(notificationData.version, 10);
|
||||
pushToken = notificationData.token;
|
||||
} catch {
|
||||
self.registration.showNotification(event.data.text());
|
||||
return;
|
||||
@@ -45,6 +49,8 @@ self.addEventListener('push', event => {
|
||||
const formData = new FormData();
|
||||
formData.append('item_id', itemId.toString(10));
|
||||
formData.append('type_id', typeId.toString(10));
|
||||
formData.append('user_id', userId.toString(10));
|
||||
formData.append('token', pushToken);
|
||||
|
||||
fetch(getNotificationUrl, {
|
||||
method: 'POST',
|
||||
|
Reference in New Issue
Block a user