Refactor: Simplify notifications plugin configuration, remove unused code, and improve channel handling

This commit is contained in:
2025-09-28 13:43:01 +02:00
parent bb963a4da4
commit 9f78d3ef72
13 changed files with 152 additions and 626 deletions

View File

@@ -151,8 +151,8 @@ export class WebPushManager {
)
return results.map((result) =>
result.status === 'fulfilled'
? result.value
result.status === 'fulfilled'
? result.value
: { success: false, error: result.reason }
)
}
@@ -211,11 +211,20 @@ export class WebPushManager {
p256dh: subscription.keys.p256dh,
auth: subscription.keys.auth,
userAgent,
channels: channels || ['all'],
channels,
isActive: true,
},
})
} else {
console.info({
user: userId,
endpoint: subscription.endpoint,
p256dh: subscription.keys.p256dh,
auth: subscription.keys.auth,
userAgent,
channels,
isActive: true,
})
// Create new subscription
await this.payload.create({
collection: 'push-subscriptions',
@@ -225,7 +234,7 @@ export class WebPushManager {
p256dh: subscription.keys.p256dh,
auth: subscription.keys.auth,
userAgent,
channels: channels || ['all'],
channels,
isActive: true,
},
})
@@ -268,4 +277,4 @@ export class WebPushManager {
public getVapidPublicKey(): string {
return this.config.vapidPublicKey
}
}
}