aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2022-11-13 13:54:24 +0800
committerGitHub <noreply@github.com>2022-11-13 00:54:24 -0500
commitac409fcfba4071a0d6868e628338b175345be2ae (patch)
treed30a7e673c91bb32951e40df382a524d58165e3e
parentdf512f77b7b6fac3efdda265a3ab9bb95a952d69 (diff)
downloadgitea-ac409fcfba4071a0d6868e628338b175345be2ae.tar.gz
gitea-ac409fcfba4071a0d6868e628338b175345be2ae.zip
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 <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
-rw-r--r--routers/api/v1/api.go2
1 files changed, 1 insertions, 1 deletions
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)