fix(webpush): avoid querying push subs with empty user list (#2380)

This commit is contained in:
0xsysr3ll
2026-02-09 15:34:13 +01:00
committed by GitHub
parent a44a3b1e14
commit e3dc1c302d

View File

@@ -260,13 +260,16 @@ class WebPushAgent
shouldSendAdminNotification(type, user, payload) shouldSendAdminNotification(type, user, payload)
); );
const allSubs = await userPushSubRepository const allSubs =
.createQueryBuilder('pushSub') manageUsers.length > 0
.leftJoinAndSelect('pushSub.user', 'user') ? await userPushSubRepository
.where('pushSub.userId IN (:...users)', { .createQueryBuilder('pushSub')
users: manageUsers.map((user) => user.id), .leftJoinAndSelect('pushSub.user', 'user')
}) .where('pushSub.userId IN (:...users)', {
.getMany(); users: manageUsers.map((user) => user.id),
})
.getMany()
: [];
// We only want to send the custom notification when type is approved or declined // We only want to send the custom notification when type is approved or declined
// Otherwise, default to the normal notification // Otherwise, default to the normal notification