From 9d07178e57cbb8068cb9161cedb96e1cd5f4273b Mon Sep 17 00:00:00 2001 From: Maksim Eltyshev Date: Tue, 8 Jul 2025 00:22:24 +0200 Subject: [PATCH] fix: Move webhooks declaration to correct position --- server/api/helpers/attachments/delete-one.js | 4 ++-- server/api/helpers/background-images/delete-one.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/api/helpers/attachments/delete-one.js b/server/api/helpers/attachments/delete-one.js index 79195db2..689cc634 100644 --- a/server/api/helpers/attachments/delete-one.js +++ b/server/api/helpers/attachments/delete-one.js @@ -35,6 +35,8 @@ module.exports = { }, async fn(inputs) { + const webhooks = await Webhook.qm.getAll(); + if (inputs.record.id === inputs.card.coverAttachmentId) { await sails.helpers.cards.updateOne.with({ webhooks, @@ -67,8 +69,6 @@ module.exports = { inputs.request, ); - const webhooks = await Webhook.qm.getAll(); - sails.helpers.utils.sendWebhooks.with({ webhooks, event: Webhook.Events.ATTACHMENT_DELETE, diff --git a/server/api/helpers/background-images/delete-one.js b/server/api/helpers/background-images/delete-one.js index 69908d70..ab839550 100644 --- a/server/api/helpers/background-images/delete-one.js +++ b/server/api/helpers/background-images/delete-one.js @@ -27,6 +27,8 @@ module.exports = { record: inputs.project, }); + const webhooks = await Webhook.qm.getAll(); + if (inputs.project.backgroundType === Project.BackgroundTypes.IMAGE) { if (inputs.record.id === inputs.project.backgroundImageId) { await sails.helpers.projects.updateOne.with({ @@ -59,8 +61,6 @@ module.exports = { ); }); - const webhooks = await Webhook.qm.getAll(); - sails.helpers.utils.sendWebhooks.with({ webhooks, event: Webhook.Events.BACKGROUND_IMAGE_DELETE,