From ac409fcfba4071a0d6868e628338b175345be2ae Mon Sep 17 00:00:00 2001 From: Jason Song Date: Sun, 13 Nov 2022 13:54:24 +0800 Subject: Load GitRepo in API before deleting issue (#21720) (#21796) 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 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 0d11674aa9..a515551a57 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -898,7 +898,7 @@ func Routes(ctx gocontext.Context) *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) -- cgit v1.2.3