From 19cba7f57eccb0779f68be49c4175bd8d59eb2fb Mon Sep 17 00:00:00 2001 From: skeris Date: Tue, 17 Jun 2025 17:21:37 +0300 Subject: [PATCH] fix: if empty que title not render answers --- internal/answerwc/template/to_client.tmpl | 2 +- internal/senders/common.go | 11 ++++++++--- tests/mail/to_client.tmpl | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/internal/answerwc/template/to_client.tmpl b/internal/answerwc/template/to_client.tmpl index 2c98634..7450cbb 100644 --- a/internal/answerwc/template/to_client.tmpl +++ b/internal/answerwc/template/to_client.tmpl @@ -483,7 +483,7 @@ {{ range .AllAnswers }} - {{ if index $.QuestionsMap .AnswerID }} + {{ if keyExists $.QuestionsMap .AnswerID }} %s
", res.Description, strings.Replace(res.Image,"http","https",1))) + builder.WriteString(fmt.Sprintf("", res.Description, strings.Replace(res.Image, "http", "https", 1))) } } @@ -105,7 +110,7 @@ func sanitizeHTMLData(data TemplateData) TemplateData { AllAnswers: stripHTMLResultAnswers(data.AllAnswers), QuestionsMap: stripHTMLResultMap(data.QuestionsMap), AnswerTime: StripHTML(data.AnswerTime), - QuizID: data.QuizID, + QuizID: data.QuizID, } return sanitized } diff --git a/tests/mail/to_client.tmpl b/tests/mail/to_client.tmpl index fe36b93..7450cbb 100644 --- a/tests/mail/to_client.tmpl +++ b/tests/mail/to_client.tmpl @@ -80,6 +80,7 @@
%s