@@ -22,6 +22,7 @@ import (
22
22
"code.gitea.io/gitea/modules/markup"
23
23
"code.gitea.io/gitea/modules/markup/markdown"
24
24
"code.gitea.io/gitea/modules/setting"
25
+ "code.gitea.io/gitea/modules/templates"
25
26
"code.gitea.io/gitea/modules/timeutil"
26
27
"code.gitea.io/gitea/modules/translation"
27
28
@@ -67,13 +68,14 @@ func sendUserMail(language string, u *models.User, tpl base.TplName, code, subje
67
68
"ActiveCodeLives" : timeutil .MinutesToFriendly (setting .Service .ActiveCodeLives , language ),
68
69
"ResetPwdCodeLives" : timeutil .MinutesToFriendly (setting .Service .ResetPwdCodeLives , language ),
69
70
"Code" : code ,
70
- "i18n" : locale ,
71
71
"Language" : locale .Language (),
72
+ // helper
73
+ "i18n" : locale ,
74
+ "Str2html" : templates .Str2html ,
72
75
}
73
76
74
77
var content bytes.Buffer
75
78
76
- // TODO: i18n templates?
77
79
if err := bodyTemplates .ExecuteTemplate (& content , string (tpl ), data ); err != nil {
78
80
log .Error ("Template: %v" , err )
79
81
return
@@ -104,13 +106,14 @@ func SendActivateEmailMail(u *models.User, email *models.EmailAddress) {
104
106
"ActiveCodeLives" : timeutil .MinutesToFriendly (setting .Service .ActiveCodeLives , locale .Language ()),
105
107
"Code" : u .GenerateEmailActivateCode (email .Email ),
106
108
"Email" : email .Email ,
107
- "i18n" : locale ,
108
109
"Language" : locale .Language (),
110
+ // helper
111
+ "i18n" : locale ,
112
+ "Str2html" : templates .Str2html ,
109
113
}
110
114
111
115
var content bytes.Buffer
112
116
113
- // TODO: i18n templates?
114
117
if err := bodyTemplates .ExecuteTemplate (& content , string (mailAuthActivateEmail ), data ); err != nil {
115
118
log .Error ("Template: %v" , err )
116
119
return
@@ -129,13 +132,14 @@ func SendRegisterNotifyMail(u *models.User) {
129
132
data := map [string ]interface {}{
130
133
"DisplayName" : u .DisplayName (),
131
134
"Username" : u .Name ,
132
- "i18n" : locale ,
133
135
"Language" : locale .Language (),
136
+ // helper
137
+ "i18n" : locale ,
138
+ "Str2html" : templates .Str2html ,
134
139
}
135
140
136
141
var content bytes.Buffer
137
142
138
- // TODO: i18n templates?
139
143
if err := bodyTemplates .ExecuteTemplate (& content , string (mailAuthRegisterNotify ), data ); err != nil {
140
144
log .Error ("Template: %v" , err )
141
145
return
@@ -157,13 +161,14 @@ func SendCollaboratorMail(u, doer *models.User, repo *models.Repository) {
157
161
"Subject" : subject ,
158
162
"RepoName" : repoName ,
159
163
"Link" : repo .HTMLURL (),
160
- "i18n" : locale ,
161
164
"Language" : locale .Language (),
165
+ // helper
166
+ "i18n" : locale ,
167
+ "Str2html" : templates .Str2html ,
162
168
}
163
169
164
170
var content bytes.Buffer
165
171
166
- // TODO: i18n templates?
167
172
if err := bodyTemplates .ExecuteTemplate (& content , string (mailNotifyCollaborator ), data ); err != nil {
168
173
log .Error ("Template: %v" , err )
169
174
return
@@ -239,12 +244,13 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient
239
244
"ActionType" : actType ,
240
245
"ActionName" : actName ,
241
246
"ReviewComments" : reviewComments ,
242
- "i18n" : locale ,
243
247
"Language" : locale .Language (),
248
+ // helper
249
+ "i18n" : locale ,
250
+ "Str2html" : templates .Str2html ,
244
251
}
245
252
246
253
var mailSubject bytes.Buffer
247
- // TODO: i18n templates?
248
254
if err := subjectTemplates .ExecuteTemplate (& mailSubject , string (tplName ), mailMeta ); err == nil {
249
255
subject = sanitizeSubject (mailSubject .String ())
250
256
if subject == "" {
@@ -260,7 +266,6 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient
260
266
261
267
var mailBody bytes.Buffer
262
268
263
- // TODO: i18n templates?
264
269
if err := bodyTemplates .ExecuteTemplate (& mailBody , string (tplName ), mailMeta ); err != nil {
265
270
log .Error ("ExecuteTemplate [%s]: %v" , string (tplName )+ "/body" , err )
266
271
}
0 commit comments