From 4c2f059fb5b47d4084616ff56870a29b950b8211 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Mon, 21 Apr 2025 23:00:21 +0200 Subject: [PATCH] Fix push notifications sent without thread subscription (#2118) * Fix push notifications sent without thread subscription * Remove duplicate ancestor check --- lib/webPush.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/webPush.js b/lib/webPush.js index de24dd09..d28ab8bb 100644 --- a/lib/webPush.js +++ b/lib/webPush.js @@ -256,6 +256,10 @@ export const notifyItemParents = async ({ models, item }) => { AND NOT EXISTS ( SELECT 1 FROM "Mute" m WHERE m."muterId" = p."userId" AND m."mutedId" = ${Number(user.id)} + ) + AND EXISTS ( + -- check that there is at least one parent subscribed to this thread + SELECT 1 FROM "ThreadSubscription" ts WHERE p.id = ts."itemId" )` await Promise.allSettled( parents.map(({ userId, isDirect }) => {