fix(webpush): avoid querying push subs with empty user list (#2380)
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user