From 4831ada3d2823570751132d252a18f93befb92ee Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Wed, 24 Nov 2021 19:11:28 +0100 Subject: [PATCH] Add List-Unsubscribe header Fixes #13283 --- services/mailer/mail.go | 2 +- services/mailer/mail_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/services/mailer/mail.go b/services/mailer/mail.go index a9978be8b190a..7e1bb944c9ad0 100644 --- a/services/mailer/mail.go +++ b/services/mailer/mail.go @@ -347,7 +347,7 @@ func generateAdditionalHeaders(ctx *mailCommentContext, reason string, recipient // https://datatracker.ietf.org/doc/html/rfc2369 "List-Archive": fmt.Sprintf("<%s>", repo.HTMLURL()), //"List-Post": https://github.com/go-gitea/gitea/pull/13585 - //"List-Unsubscribe": https://github.com/go-gitea/gitea/issues/10808, https://github.com/go-gitea/gitea/issues/13283 + "List-Unsubscribe": ctx.Issue.HTMLURL(), "X-Gitea-Reason": reason, "X-Gitea-Sender": ctx.Doer.DisplayName(), diff --git a/services/mailer/mail_test.go b/services/mailer/mail_test.go index 8e8cd98231254..e1e23ee99b541 100644 --- a/services/mailer/mail_test.go +++ b/services/mailer/mail_test.go @@ -217,6 +217,7 @@ func TestGenerateAdditionalHeaders(t *testing.T) { expected := map[string]string{ "List-ID": "user2/repo1 ", "List-Archive": "", + "List-Unsubscribe": "https://try.gitea.io/user2/repo1/issues/1", "X-Gitea-Reason": "dummy-reason", "X-Gitea-Sender": "< Ur Tw ><", "X-Gitea-Recipient": "Test",