MSG-AFTER`, att1.UUID)
require.NoError(t, issues_model.UpdateIssueCols(t.Context(), issue, "content"))
diff --git a/services/mailer/mail_user.go b/services/mailer/mail_user.go
index 68df81f6a3a..867a8b2a8f4 100644
--- a/services/mailer/mail_user.go
+++ b/services/mailer/mail_user.go
@@ -7,7 +7,6 @@ import (
"bytes"
"fmt"
- repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
@@ -18,11 +17,10 @@ import (
)
const (
- mailAuthActivate templates.TplName = "auth/activate"
- mailAuthActivateEmail templates.TplName = "auth/activate_email"
- mailAuthResetPassword templates.TplName = "auth/reset_passwd"
- mailAuthRegisterNotify templates.TplName = "auth/register_notify"
- mailNotifyCollaborator templates.TplName = "notify/collaborator"
+ mailAuthActivate templates.TplName = "user/auth/activate"
+ mailAuthActivateEmail templates.TplName = "user/auth/activate_email"
+ mailAuthResetPassword templates.TplName = "user/auth/reset_passwd"
+ mailAuthRegisterNotify templates.TplName = "user/auth/register_notify"
)
// sendUserMail sends a mail to the user
@@ -128,34 +126,3 @@ func SendRegisterNotifyMail(u *user_model.User) {
SendAsync(msg)
}
-
-// SendCollaboratorMail sends mail notification to new collaborator.
-func SendCollaboratorMail(u, doer *user_model.User, repo *repo_model.Repository) {
- if setting.MailService == nil || !u.IsActive {
- // No mail service configured OR the user is inactive
- return
- }
- locale := translation.NewLocale(u.Language)
- repoName := repo.FullName()
-
- subject := locale.TrString("mail.repo.collaborator.added.subject", doer.DisplayName(), repoName)
- data := map[string]any{
- "locale": locale,
- "Subject": subject,
- "RepoName": repoName,
- "Link": repo.HTMLURL(),
- "Language": locale.Language(),
- }
-
- var content bytes.Buffer
-
- if err := LoadedTemplates().BodyTemplates.ExecuteTemplate(&content, string(mailNotifyCollaborator), data); err != nil {
- log.Error("Template: %v", err)
- return
- }
-
- msg := sender_service.NewMessage(u.EmailTo(), subject, content.String())
- msg.Info = fmt.Sprintf("UID: %d, add collaborator", u.ID)
-
- SendAsync(msg)
-}
diff --git a/services/mailer/mail_workflow_run.go b/services/mailer/mail_workflow_run.go
index 29b3abda8ee..da791894a53 100644
--- a/services/mailer/mail_workflow_run.go
+++ b/services/mailer/mail_workflow_run.go
@@ -15,12 +15,13 @@ import (
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
+ "code.gitea.io/gitea/modules/templates"
"code.gitea.io/gitea/modules/translation"
"code.gitea.io/gitea/services/convert"
sender_service "code.gitea.io/gitea/services/mailer/sender"
)
-const tplWorkflowRun = "notify/workflow_run"
+const tplWorkflowRun templates.TplName = "repo/actions/workflow_run"
type convertedWorkflowJob struct {
HTMLURL string
@@ -103,7 +104,7 @@ func composeAndSendActionsWorkflowRunStatusEmail(ctx context.Context, repo *repo
runStatusText = "All jobs have been cancelled"
}
var mailBody bytes.Buffer
- if err := LoadedTemplates().BodyTemplates.ExecuteTemplate(&mailBody, tplWorkflowRun, map[string]any{
+ if err := LoadedTemplates().BodyTemplates.ExecuteTemplate(&mailBody, string(tplWorkflowRun), map[string]any{
"Subject": subject,
"Repo": repo,
"Run": run,
diff --git a/templates/mail/team_invite.tmpl b/templates/mail/org/team_invite.tmpl
similarity index 100%
rename from templates/mail/team_invite.tmpl
rename to templates/mail/org/team_invite.tmpl
diff --git a/templates/mail/notify/workflow_run.devtest.yml b/templates/mail/repo/actions/workflow_run.devtest.yml
similarity index 100%
rename from templates/mail/notify/workflow_run.devtest.yml
rename to templates/mail/repo/actions/workflow_run.devtest.yml
diff --git a/templates/mail/notify/workflow_run.tmpl b/templates/mail/repo/actions/workflow_run.tmpl
similarity index 100%
rename from templates/mail/notify/workflow_run.tmpl
rename to templates/mail/repo/actions/workflow_run.tmpl
diff --git a/templates/mail/notify/collaborator.tmpl b/templates/mail/repo/collaborator.tmpl
similarity index 100%
rename from templates/mail/notify/collaborator.tmpl
rename to templates/mail/repo/collaborator.tmpl
diff --git a/templates/mail/issue/assigned.tmpl b/templates/mail/repo/issue/assigned.tmpl
similarity index 100%
rename from templates/mail/issue/assigned.tmpl
rename to templates/mail/repo/issue/assigned.tmpl
diff --git a/templates/mail/issue/default.tmpl b/templates/mail/repo/issue/default.tmpl
similarity index 100%
rename from templates/mail/issue/default.tmpl
rename to templates/mail/repo/issue/default.tmpl
diff --git a/templates/mail/release.tmpl b/templates/mail/repo/release.tmpl
similarity index 100%
rename from templates/mail/release.tmpl
rename to templates/mail/repo/release.tmpl
diff --git a/templates/mail/notify/repo_transfer.tmpl b/templates/mail/repo/transfer.tmpl
similarity index 100%
rename from templates/mail/notify/repo_transfer.tmpl
rename to templates/mail/repo/transfer.tmpl
diff --git a/templates/mail/auth/activate.devtest.yml b/templates/mail/user/auth/activate.devtest.yml
similarity index 100%
rename from templates/mail/auth/activate.devtest.yml
rename to templates/mail/user/auth/activate.devtest.yml
diff --git a/templates/mail/auth/activate.tmpl b/templates/mail/user/auth/activate.tmpl
similarity index 100%
rename from templates/mail/auth/activate.tmpl
rename to templates/mail/user/auth/activate.tmpl
diff --git a/templates/mail/user/auth/activate_email.devtest.yml b/templates/mail/user/auth/activate_email.devtest.yml
new file mode 100644
index 00000000000..f5519a6f6c0
--- /dev/null
+++ b/templates/mail/user/auth/activate_email.devtest.yml
@@ -0,0 +1,3 @@
+DisplayName: User Display Name
+Code: The-Activation-Code
+ActiveCodeLives: 24h
diff --git a/templates/mail/auth/activate_email.tmpl b/templates/mail/user/auth/activate_email.tmpl
similarity index 100%
rename from templates/mail/auth/activate_email.tmpl
rename to templates/mail/user/auth/activate_email.tmpl
diff --git a/templates/mail/user/auth/register_notify.devtest.yml b/templates/mail/user/auth/register_notify.devtest.yml
new file mode 100644
index 00000000000..8c9d6837d45
--- /dev/null
+++ b/templates/mail/user/auth/register_notify.devtest.yml
@@ -0,0 +1,2 @@
+DisplayName: User Display Name
+Username: Username
diff --git a/templates/mail/auth/register_notify.tmpl b/templates/mail/user/auth/register_notify.tmpl
similarity index 100%
rename from templates/mail/auth/register_notify.tmpl
rename to templates/mail/user/auth/register_notify.tmpl
diff --git a/templates/mail/user/auth/reset_passwd.devtest.yml b/templates/mail/user/auth/reset_passwd.devtest.yml
new file mode 100644
index 00000000000..4c73d6b952d
--- /dev/null
+++ b/templates/mail/user/auth/reset_passwd.devtest.yml
@@ -0,0 +1,3 @@
+DisplayName: User Display Name
+Code: The-Activation-Code
+ResetPwdCodeLives: 24h
diff --git a/templates/mail/auth/reset_passwd.tmpl b/templates/mail/user/auth/reset_passwd.tmpl
similarity index 100%
rename from templates/mail/auth/reset_passwd.tmpl
rename to templates/mail/user/auth/reset_passwd.tmpl
From 9993fc69e99539878b6d2ec89f93ebe3e88d9a9b Mon Sep 17 00:00:00 2001
From: NorthRealm <155140859+NorthRealm@users.noreply.github.com>
Date: Wed, 23 Jul 2025 21:38:47 +0800
Subject: [PATCH 2/5] MOVE
---
templates/mail/org/team_invite.devtest.yml | 13 +++++++++++++
.../mail/repo/actions/workflow_run.devtest.yml | 8 ++++----
templates/mail/repo/collaborator.devtest.yml | 3 +++
templates/mail/repo/collaborator.tmpl | 5 +----
templates/mail/repo/issue/assigned.devtest.yml | 11 +++++++++++
templates/mail/repo/issue/assigned.tmpl | 5 +----
templates/mail/repo/issue/default.tmpl | 13 ++++++-------
templates/mail/repo/release.tmpl | 13 ++++++-------
templates/mail/repo/transfer.devtest.yml | 3 +++
templates/mail/repo/transfer.tmpl | 12 +++++++-----
templates/mail/user/auth/activate_email.devtest.yml | 1 +
templates/mail/user/auth/reset_passwd.devtest.yml | 2 +-
12 files changed, 57 insertions(+), 32 deletions(-)
create mode 100644 templates/mail/org/team_invite.devtest.yml
create mode 100644 templates/mail/repo/collaborator.devtest.yml
create mode 100644 templates/mail/repo/issue/assigned.devtest.yml
create mode 100644 templates/mail/repo/transfer.devtest.yml
diff --git a/templates/mail/org/team_invite.devtest.yml b/templates/mail/org/team_invite.devtest.yml
new file mode 100644
index 00000000000..dc51a74d641
--- /dev/null
+++ b/templates/mail/org/team_invite.devtest.yml
@@ -0,0 +1,13 @@
+Inviter:
+ DisplayName: Inviter Display Name
+
+Team:
+ Name: Team name
+
+Organization:
+ DisplayName: Organization Display Name
+
+InviteURL: http://localhost/org/team/invite
+
+Invite:
+ Email: invited@example.com
diff --git a/templates/mail/repo/actions/workflow_run.devtest.yml b/templates/mail/repo/actions/workflow_run.devtest.yml
index 1e285be328b..3d93ad45a3a 100644
--- a/templates/mail/repo/actions/workflow_run.devtest.yml
+++ b/templates/mail/repo/actions/workflow_run.devtest.yml
@@ -1,10 +1,10 @@
-RunStatusText: run status text ....
+RunStatusText: Jobs status aggregation
Repo:
- FullName: RepoName
+ FullName: Repo/Name
Run:
- WorkflowID: WorkflowID
+ WorkflowID: workflow.yml
HTMLURL: http://localhost/run/1
Jobs:
@@ -13,6 +13,6 @@ Jobs:
Attempt: 1
HTMLURL: http://localhost/job/1
- Name: Job-Name-2
- Status: failed
+ Status: failure
Attempt: 2
HTMLURL: http://localhost/job/2
diff --git a/templates/mail/repo/collaborator.devtest.yml b/templates/mail/repo/collaborator.devtest.yml
new file mode 100644
index 00000000000..8d8f2b27333
--- /dev/null
+++ b/templates/mail/repo/collaborator.devtest.yml
@@ -0,0 +1,3 @@
+Subject: Collaborator added
+Link: http://localhost
+RepoName: Repo/Name
diff --git a/templates/mail/repo/collaborator.tmpl b/templates/mail/repo/collaborator.tmpl
index 9810c709842..3fe490e2211 100644
--- a/templates/mail/repo/collaborator.tmpl
+++ b/templates/mail/repo/collaborator.tmpl
@@ -1,16 +1,13 @@
-
{{.Subject}}
{{.locale.Tr "mail.repo.collaborator.added.text"}} {{.RepoName}}
-