From 795913e3c7f37c55a81e64517c740f0402b6230d Mon Sep 17 00:00:00 2001 From: Jason Song Date: Sun, 13 Nov 2022 12:13:31 +0800 Subject: [PATCH] Load GitRepo in API before deleting issue (#21720) (#21795) Backport #21720. Fix #20921. The `ctx.Repo.GitRepo` has been used in deleting issues when the issue is a PR. Co-authored-by: Lunny Xiao Co-authored-by: Lauris BH --- routers/api/v1/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 7efaeaab86..6fcbaefc93 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -890,7 +890,7 @@ func Routes() *web.Route { m.Group("/{index}", func() { m.Combo("").Get(repo.GetIssue). Patch(reqToken(), bind(api.EditIssueOption{}), repo.EditIssue). - Delete(reqToken(), reqAdmin(), repo.DeleteIssue) + Delete(reqToken(), reqAdmin(), context.ReferencesGitRepo(), repo.DeleteIssue) m.Group("/comments", func() { m.Combo("").Get(repo.ListIssueComments). Post(reqToken(), mustNotBeArchived, bind(api.CreateIssueCommentOption{}), repo.CreateIssueComment) -- 2.39.5