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