From 685a903cd5d8f760f3f915f0d703594abe34ba6a Mon Sep 17 00:00:00 2001 From: Gusted Date: Fri, 26 Jul 2024 15:16:54 +0200 Subject: [PATCH] [MAIL] Use correct function in mail footer - Regression of #4635 - The authentication mails weren't being sent with links to the instance, because the the wrong variable was used in the mail footer. `$.AppUrl` should've been `AppUrl`. - Unit test added. --- services/mailer/mail_auth_test.go | 2 ++ templates/mail/common/footer_simple.tmpl | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/services/mailer/mail_auth_test.go b/services/mailer/mail_auth_test.go index 5346ae0d49..38e3721a22 100644 --- a/services/mailer/mail_auth_test.go +++ b/services/mailer/mail_auth_test.go @@ -10,6 +10,7 @@ import ( "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/optional" + "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/translation" "code.gitea.io/gitea/services/mailer" user_service "code.gitea.io/gitea/services/user" @@ -49,6 +50,7 @@ func TestPrimaryMailChange(t *testing.T) { assert.Equal(t, user.EmailTo(firstEmail.Email), msgs[0].To) assert.EqualValues(t, translation.NewLocale("en-US").Tr("mail.primary_mail_change.subject"), msgs[0].Subject) assert.Contains(t, msgs[0].Body, secondEmail.Email) + assert.Contains(t, msgs[0].Body, setting.AppURL) mailer.AssertTranslatedLocale(t, msgs[0].Body, "mail.primary_mail_change.text_1", "mail.primary_mail_change.text_2", "mail.primary_mail_change.text_3") called = true })() diff --git a/templates/mail/common/footer_simple.tmpl b/templates/mail/common/footer_simple.tmpl index 9011d69d00..baec3e5fd3 100644 --- a/templates/mail/common/footer_simple.tmpl +++ b/templates/mail/common/footer_simple.tmpl @@ -1 +1 @@ -

{{AppName}}

+

{{AppName}}