loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request 'mail issue: Display issue type in email header' (#5389) from xenrox/forgejo:mail-issue into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5389
Reviewed-by: Gusted <gusted@noreply.codeberg.org>

Gusted cd7c015d b43d9d5a

+15 -4
+4 -1
services/mailer/mail_issue.go
··· 19 19 ) 20 20 21 21 func fallbackMailSubject(issue *issues_model.Issue) string { 22 - return fmt.Sprintf("[%s] %s (#%d)", issue.Repo.FullName(), issue.Title, issue.Index) 22 + if issue.IsPull { 23 + return fmt.Sprintf("[%s] %s (PR #%d)", issue.Repo.FullName(), issue.Title, issue.Index) 24 + } 25 + return fmt.Sprintf("[%s] %s (Issue #%d)", issue.Repo.FullName(), issue.Title, issue.Index) 23 26 } 24 27 25 28 type mailCommentContext struct {
+11 -3
services/mailer/mail_test.go
··· 138 138 references := gomailMsg.GetHeader("References") 139 139 140 140 assert.Len(t, mailto, 1, "exactly one recipient is expected in the To field") 141 - assert.Equal(t, "[user2/repo1] issue1 (#1)", subject[0]) 141 + assert.Equal(t, "[user2/repo1] issue1 (Issue #1)", subject[0]) 142 142 assert.Equal(t, "<user2/repo1/issues/1@localhost>", inReplyTo[0], "In-Reply-To header doesn't match") 143 143 assert.Equal(t, "<user2/repo1/issues/1@localhost>", references[0], "References header doesn't match") 144 144 assert.Equal(t, "<user2/repo1/issues/1@localhost>", messageID[0], "Message-ID header doesn't match") ··· 293 293 Issue: issue, Doer: doer, ActionType: activities_model.ActionCloseIssue, 294 294 Content: "test body", Comment: comment, 295 295 }, recipients, false, "TestTemplateSelection") 296 - expect(t, msg, "Re: [user2/repo1] issue1 (#1)", "issue/close/body") 296 + expect(t, msg, "Re: [user2/repo1] issue1 (Issue #1)", "issue/close/body") 297 297 } 298 298 299 299 func TestTemplateServices(t *testing.T) { ··· 338 338 expect(t, issue, comment, doer, activities_model.ActionCommentIssue, true, 339 339 "{{.FallbackSubject}}", 340 340 "//{{.SubjectPrefix}}//", 341 - "Re: [user2/repo1] issue1 (#1)", 341 + "Re: [user2/repo1] issue1 (Issue #1)", 342 342 "//Re: //") 343 343 } 344 344 ··· 538 538 assert.EqualValues(t, "Mister X (by Code IT on [code.it])", fromDisplayName(&user_model.User{FullName: "Mister X", Name: "tmp"})) 539 539 }) 540 540 } 541 + 542 + func TestFallbackSubjectType(t *testing.T) { 543 + _, _, issue, _ := prepareMailerTest(t) 544 + assert.Contains(t, fallbackMailSubject(issue), "Issue") 545 + _, _, pr, _ := prepareMailerTest(t) 546 + pr.IsPull = true 547 + assert.Contains(t, fallbackMailSubject(pr), "PR") 548 + }