mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Add List-Unsubscribe header (#17804)
Fixes #13283 Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		@@ -348,7 +348,7 @@ func generateAdditionalHeaders(ctx *mailCommentContext, reason string, recipient
 | 
				
			|||||||
		// https://datatracker.ietf.org/doc/html/rfc2369
 | 
							// https://datatracker.ietf.org/doc/html/rfc2369
 | 
				
			||||||
		"List-Archive": fmt.Sprintf("<%s>", repo.HTMLURL()),
 | 
							"List-Archive": fmt.Sprintf("<%s>", repo.HTMLURL()),
 | 
				
			||||||
		//"List-Post": https://github.com/go-gitea/gitea/pull/13585
 | 
							//"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-Reason":            reason,
 | 
				
			||||||
		"X-Gitea-Sender":            ctx.Doer.DisplayName(),
 | 
							"X-Gitea-Sender":            ctx.Doer.DisplayName(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -218,6 +218,7 @@ func TestGenerateAdditionalHeaders(t *testing.T) {
 | 
				
			|||||||
	expected := map[string]string{
 | 
						expected := map[string]string{
 | 
				
			||||||
		"List-ID":                   "user2/repo1 <repo1.user2.localhost>",
 | 
							"List-ID":                   "user2/repo1 <repo1.user2.localhost>",
 | 
				
			||||||
		"List-Archive":              "<https://try.gitea.io/user2/repo1>",
 | 
							"List-Archive":              "<https://try.gitea.io/user2/repo1>",
 | 
				
			||||||
 | 
							"List-Unsubscribe":          "https://try.gitea.io/user2/repo1/issues/1",
 | 
				
			||||||
		"X-Gitea-Reason":            "dummy-reason",
 | 
							"X-Gitea-Reason":            "dummy-reason",
 | 
				
			||||||
		"X-Gitea-Sender":            "< U<se>r Tw<o > ><",
 | 
							"X-Gitea-Sender":            "< U<se>r Tw<o > ><",
 | 
				
			||||||
		"X-Gitea-Recipient":         "Test",
 | 
							"X-Gitea-Recipient":         "Test",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user