mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
[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>
This commit is contained in:
@@ -59,7 +59,7 @@ func TestComposeIssueCommentMessage(t *testing.T) {
|
||||
|
||||
tos := []string{"test@gitea.com", "test2@gitea.com"}
|
||||
msgs := composeIssueCommentMessages(&mailCommentContext{Issue: issue, Doer: doer, ActionType: models.ActionCommentIssue,
|
||||
Content: "test body", Comment: comment}, tos, false, "issue comment")
|
||||
Content: "test body", Comment: comment}, "en-US", tos, false, "issue comment")
|
||||
assert.Len(t, msgs, 2)
|
||||
gomailMsg := msgs[0].ToMessage()
|
||||
mailto := gomailMsg.GetHeader("To")
|
||||
@@ -93,7 +93,7 @@ func TestComposeIssueMessage(t *testing.T) {
|
||||
|
||||
tos := []string{"test@gitea.com", "test2@gitea.com"}
|
||||
msgs := composeIssueCommentMessages(&mailCommentContext{Issue: issue, Doer: doer, ActionType: models.ActionCreateIssue,
|
||||
Content: "test body"}, tos, false, "issue create")
|
||||
Content: "test body"}, "en-US", tos, false, "issue create")
|
||||
assert.Len(t, msgs, 2)
|
||||
|
||||
gomailMsg := msgs[0].ToMessage()
|
||||
@@ -218,7 +218,7 @@ func TestTemplateServices(t *testing.T) {
|
||||
}
|
||||
|
||||
func testComposeIssueCommentMessage(t *testing.T, ctx *mailCommentContext, tos []string, fromMention bool, info string) *Message {
|
||||
msgs := composeIssueCommentMessages(ctx, tos, fromMention, info)
|
||||
msgs := composeIssueCommentMessages(ctx, "en-US", tos, fromMention, info)
|
||||
assert.Len(t, msgs, 1)
|
||||
return msgs[0]
|
||||
}
|
||||
|
Reference in New Issue
Block a user