From 4f9a6f4ae31d537d476212ddf80239dc65cfa9f5 Mon Sep 17 00:00:00 2001 From: dwindown Date: Sat, 3 Jan 2026 09:10:19 +0700 Subject: [PATCH] Fix variable replacement format in send-notification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- supabase/functions/send-notification/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/supabase/functions/send-notification/index.ts b/supabase/functions/send-notification/index.ts index 0bbca82..4fa549c 100644 --- a/supabase/functions/send-notification/index.ts +++ b/supabase/functions/send-notification/index.ts @@ -223,7 +223,9 @@ async function sendViaMailgun(payload: EmailPayload, apiKey: string, domain: str function replaceVariables(template: string, variables: Record): 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; }