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)
);
const allSubs = await userPushSubRepository
.createQueryBuilder('pushSub')
.leftJoinAndSelect('pushSub.user', 'user')
.where('pushSub.userId IN (:...users)', {
users: manageUsers.map((user) => user.id),
})
.getMany();
const allSubs =
manageUsers.length > 0
? await userPushSubRepository
.createQueryBuilder('pushSub')
.leftJoinAndSelect('pushSub.user', 'user')
.where('pushSub.userId IN (:...users)', {
users: manageUsers.map((user) => user.id),
})
.getMany()
: [];
// We only want to send the custom notification when type is approved or declined
// Otherwise, default to the normal notification