From 36d13d556e85bdaec2aa0d7ee1362b799c841a2c Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Wed, 26 Nov 2025 20:40:21 +0000 Subject: [PATCH] test notifications --- client/src/components/monitors/HeaderControls.tsx | 6 +++++- client/src/hooks/UseToast.ts | 9 ++++++++- server/src/controllers/MonitorController.ts | 11 ++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/client/src/components/monitors/HeaderControls.tsx b/client/src/components/monitors/HeaderControls.tsx index b0397e778..34f6f8240 100644 --- a/client/src/components/monitors/HeaderControls.tsx +++ b/client/src/components/monitors/HeaderControls.tsx @@ -48,7 +48,11 @@ export const HeaderControls = ({ loading={isPosting || isPatching} startIcon={} onClick={async () => { - await post(`/monitors/${monitor._id}/notifications/test`, {}); + const res = await post( + `/monitors/${monitor._id}/notifications/test`, + {} + ); + console.log(res); }} > {t("sendTestNotifications")} diff --git a/client/src/hooks/UseToast.ts b/client/src/hooks/UseToast.ts index 6a4884741..e9427ec83 100644 --- a/client/src/hooks/UseToast.ts +++ b/client/src/hooks/UseToast.ts @@ -2,7 +2,14 @@ import { toast, type ToastOptions } from "react-toastify"; export const useToast = () => { const showToast = (message: string, options?: ToastOptions) => { toast.dismiss(); - toast(message, options); + const baseStyle: React.CSSProperties = { + whiteSpace: "pre-line", + wordBreak: "break-word", + }; + toast(message, { + ...options, + style: { ...baseStyle, ...(options?.style || {}) }, + }); }; const toastSuccess = (msg: string, opts?: ToastOptions) => diff --git a/server/src/controllers/MonitorController.ts b/server/src/controllers/MonitorController.ts index 8132a6872..e83708f3f 100644 --- a/server/src/controllers/MonitorController.ts +++ b/server/src/controllers/MonitorController.ts @@ -310,8 +310,17 @@ class MonitorController { monitorId, teamId ); + + const msg = results + .map( + (r) => + `${r.channelName} (${r.channelType}): ${ + r.sent ? "Success" : "Failed" + }` + ) + .join("\n"); return res.status(200).json({ - message: "Notification test sent successfully", + message: msg, data: results, }); } catch (error) {