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 = [];
|
||||
|
||||
foreach ($webPush->flush() as $report) {
|
||||
if (! $report->isSuccess()) {
|
||||
$expiredEndpoints[] = (string) $report->getRequest()->getUri();
|
||||
if ($report->isSubscriptionExpired()) {
|
||||
$expiredEndpoints[] = $report->getEndpoint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,10 +10,10 @@ public function updateOrCreateSubscription(array $validated, int $userId): void
|
||||
{
|
||||
PushSubscription::updateOrCreate(
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'endpoint' => $validated['endpoint'],
|
||||
],
|
||||
[
|
||||
'user_id' => $userId,
|
||||
'public_key' => $validated['publicKey'],
|
||||
'auth_token' => $validated['authToken'],
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user