From e6c820395954f365a2b5f784f9a191880e37d3ca Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Wed, 2 Oct 2024 23:40:58 +0300 Subject: [PATCH] fix variables --- lib/replace_email_variables.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/replace_email_variables.rb b/lib/replace_email_variables.rb index 52342117..f403b82c 100644 --- a/lib/replace_email_variables.rb +++ b/lib/replace_email_variables.rb @@ -23,7 +23,7 @@ module ReplaceEmailVariables # rubocop:disable Metrics def call(text, submitter:, tracking_event_type: 'click_email', html_escape: false, sig: nil) - text = replace(text, TEMPLATE_NAME, html_escape:) { submitter.template.name } + text = replace(text, TEMPLATE_NAME, html_escape:) { (submitter.template || submitter.submission.template).name } text = replace(text, TEMPLATE_ID, html_escape:) { submitter.template.id } text = replace(text, SUBMITTER_ID, html_escape:) { submitter.id } text = replace(text, SUBMITTER_SLUG, html_escape:) { submitter.slug }