aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-04-02 12:25:13 +0200
committerGitHub <noreply@github.com>2021-04-02 11:25:13 +0100
commit80d6c6d7deb3f6a38ff6d09ec38ffb04de9da726 (patch)
tree8651abe082da4e920753f03ee4c37de1668ab826 /routers
parentcc2d540092149166c9a0cef886b2e952ac9c75d7 (diff)
downloadgitea-80d6c6d7deb3f6a38ff6d09ec38ffb04de9da726.tar.gz
gitea-80d6c6d7deb3f6a38ff6d09ec38ffb04de9da726.zip
[refactor] mailer service (#15072)
* Unexport SendUserMail * Instead of "[]*models.User" or "[]string" lists infent "[]*MailRecipient" for mailer * adopt * code format * TODOs for "i18n" * clean * no fallback for lang -> just use english * lint * exec testComposeIssueCommentMessage per lang and use only emails * rm MailRecipient * Dont reload from users from db if you alredy have in ram * nits * minimize diff Signed-off-by: 6543 <6543@obermui.de> * localize subjects * linter ... * Tr extend * start tmpl edit ... * Apply suggestions from code review * use translation.Locale * improve mailIssueCommentBatch Signed-off-by: Andrew Thornton <art27@cantab.net> * add i18n to datas Signed-off-by: Andrew Thornton <art27@cantab.net> * a comment Co-authored-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers')
-rw-r--r--routers/admin/users.go2
-rw-r--r--routers/api/v1/admin/user.go2
-rw-r--r--routers/user/auth.go2
-rw-r--r--routers/user/setting/account.go4
4 files changed, 5 insertions, 5 deletions
diff --git a/routers/admin/users.go b/routers/admin/users.go
index 2d40a883af..e3f5692030 100644
--- a/routers/admin/users.go
+++ b/routers/admin/users.go
@@ -154,7 +154,7 @@ func NewUserPost(ctx *context.Context) {
// Send email notification.
if form.SendNotify {
- mailer.SendRegisterNotifyMail(ctx.Locale, u)
+ mailer.SendRegisterNotifyMail(u)
}
ctx.Flash.Success(ctx.Tr("admin.users.new_success", u.Name))
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index cbb9f6b21c..5a74c6ccd5 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -114,7 +114,7 @@ func CreateUser(ctx *context.APIContext) {
// Send email notification.
if form.SendNotify {
- mailer.SendRegisterNotifyMail(ctx.Locale, u)
+ mailer.SendRegisterNotifyMail(u)
}
ctx.JSON(http.StatusCreated, convert.ToUser(u, ctx.User))
}
diff --git a/routers/user/auth.go b/routers/user/auth.go
index 37181c68e7..9217885519 100644
--- a/routers/user/auth.go
+++ b/routers/user/auth.go
@@ -1397,7 +1397,7 @@ func ForgotPasswdPost(ctx *context.Context) {
return
}
- mailer.SendResetPasswordMail(ctx.Locale, u)
+ mailer.SendResetPasswordMail(u)
if err = ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil {
log.Error("Set cache(MailResendLimit) fail: %v", err)
diff --git a/routers/user/setting/account.go b/routers/user/setting/account.go
index 4900bba14a..0bf6cf8b87 100644
--- a/routers/user/setting/account.go
+++ b/routers/user/setting/account.go
@@ -132,7 +132,7 @@ func EmailPost(ctx *context.Context) {
ctx.Redirect(setting.AppSubURL + "/user/settings/account")
return
}
- mailer.SendActivateEmailMail(ctx.Locale, ctx.User, email)
+ mailer.SendActivateEmailMail(ctx.User, email)
address = email.Email
}
@@ -194,7 +194,7 @@ func EmailPost(ctx *context.Context) {
// Send confirmation email
if setting.Service.RegisterEmailConfirm {
- mailer.SendActivateEmailMail(ctx.Locale, ctx.User, email)
+ mailer.SendActivateEmailMail(ctx.User, email)
if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil {
log.Error("Set cache(MailResendLimit) fail: %v", err)
}