fix: update SendPushNotificationJob to correctly handle expired subscriptions; modify PushSubscriptionService to ensure user_id is set during subscription creation
This commit is contained in:
parent
5a5d2c6f78
commit
18ccd7a3c0
@ -84,8 +84,8 @@ private function sendWebPush(): void
|
|||||||
$expiredEndpoints = [];
|
$expiredEndpoints = [];
|
||||||
|
|
||||||
foreach ($webPush->flush() as $report) {
|
foreach ($webPush->flush() as $report) {
|
||||||
if (! $report->isSuccess()) {
|
if ($report->isSubscriptionExpired()) {
|
||||||
$expiredEndpoints[] = (string) $report->getRequest()->getUri();
|
$expiredEndpoints[] = $report->getEndpoint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,10 +10,10 @@ public function updateOrCreateSubscription(array $validated, int $userId): void
|
|||||||
{
|
{
|
||||||
PushSubscription::updateOrCreate(
|
PushSubscription::updateOrCreate(
|
||||||
[
|
[
|
||||||
'user_id' => $userId,
|
|
||||||
'endpoint' => $validated['endpoint'],
|
'endpoint' => $validated['endpoint'],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
'user_id' => $userId,
|
||||||
'public_key' => $validated['publicKey'],
|
'public_key' => $validated['publicKey'],
|
||||||
'auth_token' => $validated['authToken'],
|
'auth_token' => $validated['authToken'],
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user