@@ -115,7 +115,7 @@ func TestComposeIssueComment(t *testing.T) {
115115 setting .IncomingEmail .Enabled = true
116116 defer func () { setting .IncomingEmail .Enabled = false }()
117117
118- prepareMailTemplates ("issue/comment" , subjectTpl , bodyTpl )
118+ prepareMailTemplates ("repo/ issue/comment" , subjectTpl , bodyTpl )
119119
120120 recipients := []* user_model.User {{Name : "Test" , Email : "test@gitea.com" }, {Name : "Test2" , Email : "test2@gitea.com" }}
121121 msgs , err := composeIssueCommentMessages (t .Context (), & mailComment {
@@ -160,7 +160,7 @@ func TestComposeIssueComment(t *testing.T) {
160160func TestMailMentionsComment (t * testing.T ) {
161161 doer , _ , issue , comment := prepareMailerTest (t )
162162 comment .Poster = doer
163- prepareMailTemplates ("issue/comment" , subjectTpl , bodyTpl )
163+ prepareMailTemplates ("repo/ issue/comment" , subjectTpl , bodyTpl )
164164 mails := 0
165165
166166 defer test .MockVariableValue (& SendAsync , func (msgs ... * sender_service.Message ) {
@@ -175,7 +175,7 @@ func TestMailMentionsComment(t *testing.T) {
175175func TestComposeIssueMessage (t * testing.T ) {
176176 doer , _ , issue , _ := prepareMailerTest (t )
177177
178- prepareMailTemplates ("issue/new" , subjectTpl , bodyTpl )
178+ prepareMailTemplates ("repo/ issue/new" , subjectTpl , bodyTpl )
179179 recipients := []* user_model.User {{Name : "Test" , Email : "test@gitea.com" }, {Name : "Test2" , Email : "test2@gitea.com" }}
180180 msgs , err := composeIssueCommentMessages (t .Context (), & mailComment {
181181 Issue : issue , Doer : doer , ActionType : activities_model .ActionCreateIssue ,
@@ -204,14 +204,14 @@ func TestTemplateSelection(t *testing.T) {
204204 doer , repo , issue , comment := prepareMailerTest (t )
205205 recipients := []* user_model.User {{Name : "Test" , Email : "test@gitea.com" }}
206206
207- prepareMailTemplates ("issue/default" , "issue/default/subject" , "issue/default/body" )
207+ prepareMailTemplates ("repo/ issue/default" , "repo/ issue/default/subject" , "repo/ issue/default/body" )
208208
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" ))
215215
216216 expect := func (t * testing.T , msg * sender_service.Message , expSubject , expBody string ) {
217217 subject := msg .ToMessage ().GetGenHeader ("Subject" )
@@ -226,27 +226,27 @@ func TestTemplateSelection(t *testing.T) {
226226 Issue : issue , Doer : doer , ActionType : activities_model .ActionCreateIssue ,
227227 Content : "test body" ,
228228 }, 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" )
230230
231231 msg = testComposeIssueCommentMessage (t , & mailComment {
232232 Issue : issue , Doer : doer , ActionType : activities_model .ActionCommentIssue ,
233233 Content : "test body" , Comment : comment ,
234234 }, 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" )
236236
237237 pull := unittest .AssertExistsAndLoadBean (t , & issues_model.Issue {ID : 2 , Repo : repo , Poster : doer })
238238 comment = unittest .AssertExistsAndLoadBean (t , & issues_model.Comment {ID : 4 , Issue : pull })
239239 msg = testComposeIssueCommentMessage (t , & mailComment {
240240 Issue : pull , Doer : doer , ActionType : activities_model .ActionCommentPull ,
241241 Content : "test body" , Comment : comment ,
242242 }, 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" )
244244
245245 msg = testComposeIssueCommentMessage (t , & mailComment {
246246 Issue : issue , Doer : doer , ActionType : activities_model .ActionCloseIssue ,
247247 Content : "test body" , Comment : comment ,
248248 }, 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" )
250250}
251251
252252func TestTemplateServices (t * testing.T ) {
@@ -256,7 +256,7 @@ func TestTemplateServices(t *testing.T) {
256256 expect := func (t * testing.T , issue * issues_model.Issue , comment * issues_model.Comment , doer * user_model.User ,
257257 actionType activities_model.ActionType , fromMention bool , tplSubject , tplBody , expSubject , expBody string ,
258258 ) {
259- prepareMailTemplates ("issue/default" , tplSubject , tplBody )
259+ prepareMailTemplates ("repo/ issue/default" , tplSubject , tplBody )
260260 recipients := []* user_model.User {{Name : "Test" , Email : "test@gitea.com" }}
261261 msg := testComposeIssueCommentMessage (t , & mailComment {
262262 Issue : issue , Doer : doer , ActionType : actionType ,
@@ -523,7 +523,7 @@ func TestEmbedBase64Images(t *testing.T) {
523523 att2ImgBase64 := fmt .Sprintf (`<img src="%s"/>` , att2Base64 )
524524
525525 t .Run ("ComposeMessage" , func (t * testing.T ) {
526- prepareMailTemplates ("issue/new" , subjectTpl , bodyTpl )
526+ prepareMailTemplates ("repo/ issue/new" , subjectTpl , bodyTpl )
527527
528528 issue .Content = fmt .Sprintf (`MSG-BEFORE <image src="attachments/%s"> MSG-AFTER` , att1 .UUID )
529529 require .NoError (t , issues_model .UpdateIssueCols (t .Context (), issue , "content" ))
0 commit comments