Fix variable replacement format in send-notification

The replaceVariables function was only supporting {{key}} format but
the email templates use {key} format (single braces). Updated to support
both formats for compatibility.

Changes:
- Added support for {key} format in addition to {{key}}
- Ensures all template variables are properly replaced

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-01-03 09:10:19 +07:00
parent 9f8ee0d7d2
commit 4f9a6f4ae3

View File

@@ -223,7 +223,9 @@ async function sendViaMailgun(payload: EmailPayload, apiKey: string, domain: str
function replaceVariables(template: string, variables: Record<string, string>): string {
let result = template;
for (const [key, value] of Object.entries(variables)) {
// Support both {key} and {{key}} formats
result = result.replace(new RegExp(`{{${key}}}`, 'g'), value);
result = result.replace(new RegExp(`{${key}}`, 'g'), value);
}
return result;
}