0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-23 07:43:18 -05:00

mailer: Put the username in X-Forgejo-Sender and -Recipient

Following gitea#28981, set `X-Forgejo-Sender` and `X-Forgejo-Recipient`
to the username of the respective users, rather than their display name.
The username is more appropriate for these headers, for filtering
purposes. The display name is already included in the From header.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
Gergely Nagy 2024-05-28 08:20:43 +02:00
parent 95ccbb5995
commit 4bccc96684
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions

View file

@ -415,8 +415,8 @@ func generateAdditionalHeaders(ctx *mailCommentContext, reason string, recipient
"X-Gitea-Issue-Link": ctx.Issue.HTMLURL(), "X-Gitea-Issue-Link": ctx.Issue.HTMLURL(),
"X-Forgejo-Reason": reason, "X-Forgejo-Reason": reason,
"X-Forgejo-Sender": ctx.Doer.DisplayName(), "X-Forgejo-Sender": ctx.Doer.Name,
"X-Forgejo-Recipient": recipient.DisplayName(), "X-Forgejo-Recipient": recipient.Name,
"X-Forgejo-Recipient-Address": recipient.Email, "X-Forgejo-Recipient-Address": recipient.Email,
"X-Forgejo-Repository": repo.Name, "X-Forgejo-Repository": repo.Name,
"X-Forgejo-Repository-Path": repo.FullName(), "X-Forgejo-Repository-Path": repo.FullName(),

View file

@ -369,6 +369,8 @@ func TestGenerateAdditionalHeaders(t *testing.T) {
"X-Gitea-Repository-Link": "https://try.gitea.io/user2/repo1", "X-Gitea-Repository-Link": "https://try.gitea.io/user2/repo1",
"X-Gitea-Issue-ID": "1", "X-Gitea-Issue-ID": "1",
"X-Gitea-Issue-Link": "https://try.gitea.io/user2/repo1/issues/1", "X-Gitea-Issue-Link": "https://try.gitea.io/user2/repo1/issues/1",
"X-Forgejo-Sender": "user2",
"X-Forgejo-Recipient": "test",
} }
for key, value := range expected { for key, value := range expected {