From e2355d63a2af4d529466be2ee1ccfaaeec02684d Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 5 Sep 2024 18:59:10 -0400 Subject: [PATCH] fix: Usage of env.URL before environment validation --- server/utils/emails.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/utils/emails.ts b/server/utils/emails.ts index 123db8bdd1..9e2af126b8 100644 --- a/server/utils/emails.ts +++ b/server/utils/emails.ts @@ -1,8 +1,6 @@ import { NotificationEventType } from "@shared/types"; import { getBaseDomain } from "@shared/utils/domains"; -const Domain = getBaseDomain(); - const EmailThreadSupportedNotifications = [ NotificationEventType.PublishDocument, NotificationEventType.UpdateDocument, @@ -41,4 +39,9 @@ export const getEmailThreadEventGroup = ( } }; -export const getEmailMessageId = (text: string) => `<${text}@${Domain}>`; +let baseDomain; + +export const getEmailMessageId = (notificationId: string) => { + baseDomain ||= getBaseDomain(); + return `<${notificationId}@${baseDomain}>`; +};