@@ -116,7 +116,7 @@ func TestComposeIssueComment(t *testing.T) {
116
116
setting .IncomingEmail .Enabled = true
117
117
defer func () { setting .IncomingEmail .Enabled = false }()
118
118
119
- prepareMailTemplates ("issue/comment" , subjectTpl , bodyTpl )
119
+ prepareMailTemplates ("repo/ issue/comment" , subjectTpl , bodyTpl )
120
120
121
121
recipients := []
* user_model.
User {{
Name :
"Test" ,
Email :
"[email protected] " }, {
Name :
"Test2" ,
Email :
"[email protected] " }}
122
122
msgs , err := composeIssueCommentMessages (t .Context (), & mailComment {
@@ -161,7 +161,7 @@ func TestComposeIssueComment(t *testing.T) {
161
161
func TestMailMentionsComment (t * testing.T ) {
162
162
doer , _ , issue , comment := prepareMailerTest (t )
163
163
comment .Poster = doer
164
- prepareMailTemplates ("issue/comment" , subjectTpl , bodyTpl )
164
+ prepareMailTemplates ("repo/ issue/comment" , subjectTpl , bodyTpl )
165
165
mails := 0
166
166
167
167
defer test .MockVariableValue (& SendAsync , func (msgs ... * sender_service.Message ) {
@@ -176,7 +176,7 @@ func TestMailMentionsComment(t *testing.T) {
176
176
func TestComposeIssueMessage (t * testing.T ) {
177
177
doer , _ , issue , _ := prepareMailerTest (t )
178
178
179
- prepareMailTemplates ("issue/new" , subjectTpl , bodyTpl )
179
+ prepareMailTemplates ("repo/ issue/new" , subjectTpl , bodyTpl )
180
180
recipients := []
* user_model.
User {{
Name :
"Test" ,
Email :
"[email protected] " }, {
Name :
"Test2" ,
Email :
"[email protected] " }}
181
181
msgs , err := composeIssueCommentMessages (t .Context (), & mailComment {
182
182
Issue : issue , Doer : doer , ActionType : activities_model .ActionCreateIssue ,
@@ -205,14 +205,14 @@ func TestTemplateSelection(t *testing.T) {
205
205
doer , repo , issue , comment := prepareMailerTest (t )
206
206
recipients := []
* user_model.
User {{
Name :
"Test" ,
Email :
"[email protected] " }}
207
207
208
- prepareMailTemplates ("issue/default" , "issue/default/subject" , "issue/default/body" )
208
+ prepareMailTemplates ("repo/ issue/default" , "repo/ issue/default/subject" , "repo/ issue/default/body" )
209
209
210
- texttmpl .Must (LoadedTemplates ().SubjectTemplates .New ("issue/new" ).Parse ("issue/new/subject" ))
211
- texttmpl .Must (LoadedTemplates ().SubjectTemplates .New ("pull/comment" ).Parse ("pull/comment/subject" ))
212
- texttmpl .Must (LoadedTemplates ().SubjectTemplates .New ("issue/close" ).Parse ("" )) // Must default to a fallback subject
213
- template .Must (LoadedTemplates ().BodyTemplates .New ("issue/new" ).Parse ("issue/new/body" ))
214
- template .Must (LoadedTemplates ().BodyTemplates .New ("pull/comment" ).Parse ("pull/comment/body" ))
215
- template .Must (LoadedTemplates ().BodyTemplates .New ("issue/close" ).Parse ("issue/close/body" ))
210
+ texttmpl .Must (LoadedTemplates ().SubjectTemplates .New ("repo/ issue/new" ).Parse ("repo/ issue/new/subject" ))
211
+ texttmpl .Must (LoadedTemplates ().SubjectTemplates .New ("repo/ pull/comment" ).Parse ("repo/ pull/comment/subject" ))
212
+ texttmpl .Must (LoadedTemplates ().SubjectTemplates .New ("repo/ issue/close" ).Parse ("" )) // Must default to a fallback subject
213
+ template .Must (LoadedTemplates ().BodyTemplates .New ("repo/ issue/new" ).Parse ("repo/ issue/new/body" ))
214
+ template .Must (LoadedTemplates ().BodyTemplates .New ("repo/ pull/comment" ).Parse ("repo/ pull/comment/body" ))
215
+ template .Must (LoadedTemplates ().BodyTemplates .New ("repo/ issue/close" ).Parse ("repo/ issue/close/body" ))
216
216
217
217
expect := func (t * testing.T , msg * sender_service.Message , expSubject , expBody string ) {
218
218
subject := msg .ToMessage ().GetGenHeader ("Subject" )
@@ -227,27 +227,27 @@ func TestTemplateSelection(t *testing.T) {
227
227
Issue : issue , Doer : doer , ActionType : activities_model .ActionCreateIssue ,
228
228
Content : "test body" ,
229
229
}, recipients , false , "TestTemplateSelection" )
230
- expect (t , msg , "issue/new/subject" , "issue/new/body" )
230
+ expect (t , msg , "repo/ issue/new/subject" , "repo/ issue/new/body" )
231
231
232
232
msg = testComposeIssueCommentMessage (t , & mailComment {
233
233
Issue : issue , Doer : doer , ActionType : activities_model .ActionCommentIssue ,
234
234
Content : "test body" , Comment : comment ,
235
235
}, recipients , false , "TestTemplateSelection" )
236
- expect (t , msg , "issue/default/subject" , "issue/default/body" )
236
+ expect (t , msg , "repo/ issue/default/subject" , "repo/ issue/default/body" )
237
237
238
238
pull := unittest .AssertExistsAndLoadBean (t , & issues_model.Issue {ID : 2 , Repo : repo , Poster : doer })
239
239
comment = unittest .AssertExistsAndLoadBean (t , & issues_model.Comment {ID : 4 , Issue : pull })
240
240
msg = testComposeIssueCommentMessage (t , & mailComment {
241
241
Issue : pull , Doer : doer , ActionType : activities_model .ActionCommentPull ,
242
242
Content : "test body" , Comment : comment ,
243
243
}, recipients , false , "TestTemplateSelection" )
244
- expect (t , msg , "pull/comment/subject" , "pull/comment/body" )
244
+ expect (t , msg , "repo/ pull/comment/subject" , "repo/ pull/comment/body" )
245
245
246
246
msg = testComposeIssueCommentMessage (t , & mailComment {
247
247
Issue : issue , Doer : doer , ActionType : activities_model .ActionCloseIssue ,
248
248
Content : "test body" , Comment : comment ,
249
249
}, recipients , false , "TestTemplateSelection" )
250
- expect (t , msg , "Re: [user2/repo1] issue1 (#1)" , "issue/close/body" )
250
+ expect (t , msg , "Re: [user2/repo1] issue1 (#1)" , "repo/ issue/close/body" )
251
251
}
252
252
253
253
func TestTemplateServices (t * testing.T ) {
@@ -257,7 +257,7 @@ func TestTemplateServices(t *testing.T) {
257
257
expect := func (t * testing.T , issue * issues_model.Issue , comment * issues_model.Comment , doer * user_model.User ,
258
258
actionType activities_model.ActionType , fromMention bool , tplSubject , tplBody , expSubject , expBody string ,
259
259
) {
260
- prepareMailTemplates ("issue/default" , tplSubject , tplBody )
260
+ prepareMailTemplates ("repo/ issue/default" , tplSubject , tplBody )
261
261
recipients := []
* user_model.
User {{
Name :
"Test" ,
Email :
"[email protected] " }}
262
262
msg := testComposeIssueCommentMessage (t , & mailComment {
263
263
Issue : issue , Doer : doer , ActionType : actionType ,
@@ -524,7 +524,7 @@ func TestEmbedBase64Images(t *testing.T) {
524
524
att2ImgBase64 := fmt .Sprintf (`<img src="%s"/>` , att2Base64 )
525
525
526
526
t .Run ("ComposeMessage" , func (t * testing.T ) {
527
- prepareMailTemplates ("issue/new" , subjectTpl , bodyTpl )
527
+ prepareMailTemplates ("repo/ issue/new" , subjectTpl , bodyTpl )
528
528
529
529
issue .Content = fmt .Sprintf (`MSG-BEFORE <image src="attachments/%s"> MSG-AFTER` , att1 .UUID )
530
530
require .NoError (t , issues_model .UpdateIssueCols (t .Context (), issue , "content" ))
0 commit comments