From 275e1e3d8332b62e3389c920d01b6dfe2db2f2f0 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Sat, 2 May 2026 11:48:04 +0200 Subject: [PATCH] fix: pr feedback double update --- .../modules/notifications/notifications.service.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/server/modules/notifications/notifications.service.ts b/app/server/modules/notifications/notifications.service.ts index d8167297..2d4d9b3a 100644 --- a/app/server/modules/notifications/notifications.service.ts +++ b/app/server/modules/notifications/notifications.service.ts @@ -213,6 +213,7 @@ const updateDeliveryStatus = async (destinationId: number, result: { success: bo const testDestination = async (id: number) => { const destination = await getDestination(id); + let result: Awaited>; try { const decryptedConfig = await decryptNotificationConfig(destination.config); @@ -222,21 +223,22 @@ const testDestination = async (id: number) => { logger.debug("Testing notification with Shoutrrr URL:", shoutrrrUrl); - const result = await sendNotification({ + result = await sendNotification({ shoutrrrUrl, title: "Zerobyte Test Notification", body: `This is a test notification from Zerobyte for destination: ${destination.name}`, }); - await updateDeliveryStatus(destination.id, result); - - if (!result.success) { - throw new InternalServerError(`Failed to send test notification: ${result.error}`); - } } catch (error) { await updateDeliveryStatus(destination.id, { success: false, error: toMessage(error) }); throw error; } + await updateDeliveryStatus(destination.id, result); + + if (!result.success) { + throw new InternalServerError(`Failed to send test notification: ${result.error}`); + } + return { success: true }; };