1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Refactor template & test related code (#32938)

Move some legacy code from "base" package to proper packages.
This commit is contained in:
wxiaoguang
2024-12-22 23:33:19 +08:00
committed by GitHub
parent afe314fa77
commit a163c53a60
109 changed files with 479 additions and 476 deletions

View File

@@ -21,11 +21,11 @@ import (
"code.gitea.io/gitea/models/renderhelper"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/emoji"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/templates"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/translation"
incoming_payload "code.gitea.io/gitea/services/mailer/incoming/payload"
@@ -34,14 +34,14 @@ import (
)
const (
mailAuthActivate base.TplName = "auth/activate"
mailAuthActivateEmail base.TplName = "auth/activate_email"
mailAuthResetPassword base.TplName = "auth/reset_passwd"
mailAuthRegisterNotify base.TplName = "auth/register_notify"
mailAuthActivate templates.TplName = "auth/activate"
mailAuthActivateEmail templates.TplName = "auth/activate_email"
mailAuthResetPassword templates.TplName = "auth/reset_passwd"
mailAuthRegisterNotify templates.TplName = "auth/register_notify"
mailNotifyCollaborator base.TplName = "notify/collaborator"
mailNotifyCollaborator templates.TplName = "notify/collaborator"
mailRepoTransferNotify base.TplName = "notify/repo_transfer"
mailRepoTransferNotify templates.TplName = "notify/repo_transfer"
// There's no actual limit for subject in RFC 5322
mailMaxSubjectRunes = 256
@@ -63,7 +63,7 @@ func SendTestMail(email string) error {
}
// sendUserMail sends a mail to the user
func sendUserMail(language string, u *user_model.User, tpl base.TplName, code, subject, info string) {
func sendUserMail(language string, u *user_model.User, tpl templates.TplName, code, subject, info string) {
locale := translation.NewLocale(language)
data := map[string]any{
"locale": locale,