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:
parent
95ccbb5995
commit
4bccc96684
2 changed files with 4 additions and 2 deletions
|
@ -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(),
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue