From 95fac7981c82491d80ab684c55cd3847d1078c73 Mon Sep 17 00:00:00 2001 From: Baobhan Sith <80159437+Heavrnl@users.noreply.github.com> Date: Sat, 26 Apr 2025 22:10:07 +0800 Subject: [PATCH] Update notification.processor.service.ts --- .../notification.processor.service.ts | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/packages/backend/src/services/notification.processor.service.ts b/packages/backend/src/services/notification.processor.service.ts index 2de2de8..889e8d9 100644 --- a/packages/backend/src/services/notification.processor.service.ts +++ b/packages/backend/src/services/notification.processor.service.ts @@ -215,29 +215,12 @@ class NotificationProcessorService extends EventEmitter { // Use user-defined template first, then the GENERIC fallback switch (setting.channel_type) { case 'email': -console.log(`[NotificationProcessor NEW DEBUG] Raw setting.config:`, JSON.stringify(setting.config)); - - -console.log(`[NotificationProcessor NEW DEBUG] Parsed emailConfig:`, JSON.stringify(emailConfig)); -if (emailConfig && typeof emailConfig === 'object') { - console.log(`[NotificationProcessor NEW DEBUG] emailConfig.subjectTemplate:`, emailConfig.subjectTemplate); - } else { - console.log(`[NotificationProcessor NEW DEBUG] emailConfig is not a valid object.`); - } - const emailConfig = setting.config as EmailConfig; // Subject is now fixed to the translated event name -if (emailConfig && typeof emailConfig === 'object') { - console.log(`[NotificationProcessor NEW DEBUG] emailConfig.subjectTemplate:`, emailConfig.subjectTemplate); - } else { - console.log(`[NotificationProcessor NEW DEBUG] emailConfig is not a valid object.`); - } subject = translatedEvent; - // Use user-defined template (from subjectTemplate field) for the BODY, or generic fallback - - - const bodyTemplate = emailConfig.subjectTemplate || genericEmailBody; + // Use user-defined template (from bodyTemplate field) for the BODY, or generic fallback + const bodyTemplate = emailConfig?.bodyTemplate || genericEmailBody; // Use optional chaining and correct property body = this.interpolate(bodyTemplate, baseInterpolationData); break;