From c773ca37ad31d4d728f360426924d859f1588387 Mon Sep 17 00:00:00 2001 From: Sunny Wan <94445569+SunnyWan59@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:23:31 -0400 Subject: [PATCH] Display app name in the registration email title (#31562) I changed the title of the registation email from "Welcome to Gitea" to "Welcome to (appname)". I did this by substituting 'Gitea' in register_notify to %s and formating the registration title in mail.go. I changed this for all the languages I could, but I struggled to changed the translation file for Farsi. I have attached the screenshots of before and after and the related issue below. Related issue: https://github.com/go-gitea/gitea/issues/31108 Before change: ![Screenshot from 2024-07-04 22-32-17](https://github.com/go-gitea/gitea/assets/94445569/4178b51c-1acc-45f4-9750-dff41564a709) After: ![Screenshot from 2024-07-04 22-32-01](https://github.com/go-gitea/gitea/assets/94445569/9cd7a58d-c0f5-4a3c-a66c-805c55411eaa) --------- Signed-off-by: Sunny Wan Co-authored-by: 6543 <6543@obermui.de> (cherry picked from commit 4913edaa70a48f7c5a524f680ca921ed515d6ec2) Conflicts: - options/locale/locale_en-US.ini Applied the change manually. Confliced because we don't have `register_notify.title`. - services/mailer/mail.go Adapted the change to Forgejo. We don't have `u.EmailTo` due to not picking gitea#31527 (yet). --- options/locale/locale_en-US.ini | 2 +- services/mailer/mail.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 2a19b1c0fe..6cc7646471 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -492,7 +492,7 @@ admin.new_user.subject = New user %s just signed up admin.new_user.user_info = User information admin.new_user.text = Please click here to manage this user from the admin panel. -register_notify = Welcome to Forgejo +register_notify = Welcome to %s register_notify.text_1 = this is your registration confirmation email for %s! register_notify.text_2 = You can sign into your account using your username: %s register_notify.text_3 = If someone else made this account for you, you will need to set your password first. diff --git a/services/mailer/mail.go b/services/mailer/mail.go index d86607295a..5eb8efe128 100644 --- a/services/mailer/mail.go +++ b/services/mailer/mail.go @@ -158,7 +158,7 @@ func SendRegisterNotifyMail(u *user_model.User) { return } - msg := NewMessage(u.Email, locale.TrString("mail.register_notify"), content.String()) + msg := NewMessage(u.Email, locale.TrString("mail.register_notify", setting.AppName), content.String()) msg.Info = fmt.Sprintf("UID: %d, registration notify", u.ID) SendAsync(msg)