summaryrefslogtreecommitdiffstats
path: root/routers/repo/issue.go
diff options
context:
space:
mode:
author赵智超 <1012112796@qq.com>2020-09-03 00:55:13 +0800
committerGitHub <noreply@github.com>2020-09-02 12:55:13 -0400
commit3981f1b1278f558721e4b40b6fdbba9365b9cb1b (patch)
tree088b17fc7caa1fa99218bc0fc21a220a02cd8faa /routers/repo/issue.go
parentea775e67fbfb42d70e207b5960e373e9def78648 (diff)
downloadgitea-3981f1b1278f558721e4b40b6fdbba9365b9cb1b.tar.gz
gitea-3981f1b1278f558721e4b40b6fdbba9365b9cb1b.zip
Remove duplicate logic in initListSubmits (#12660)
* Remove duplicate logic in initListSubmits Using the same logic to handle Choosing reviewers and assignees as choosing label. It's the first step of #10926. Signed-off-by: a1012112796 <1012112796@qq.com> * fix choose block * fix nit * try fix bug * simple code Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'routers/repo/issue.go')
-rw-r--r--routers/repo/issue.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index dabe0f6b0f..4bbc355027 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -1516,10 +1516,11 @@ func updatePullReviewRequest(ctx *context.Context) {
}
reviewID := ctx.QueryInt64("id")
- event := ctx.Query("is_add")
+ action := ctx.Query("action")
- if event != "add" && event != "remove" {
- ctx.ServerError("updatePullReviewRequest", fmt.Errorf("is_add should not be \"%s\"", event))
+ // TODO: Not support 'clear' now
+ if action != "attach" && action != "detach" {
+ ctx.Status(403)
return
}
@@ -1532,19 +1533,20 @@ func updatePullReviewRequest(ctx *context.Context) {
return
}
- err = isLegalReviewRequest(reviewer, ctx.User, event == "add", issue)
+ err = isLegalReviewRequest(reviewer, ctx.User, action == "attach", issue)
if err != nil {
ctx.ServerError("isLegalRequestReview", err)
return
}
- err = issue_service.ReviewRequest(issue, ctx.User, reviewer, event == "add")
+ err = issue_service.ReviewRequest(issue, ctx.User, reviewer, action == "attach")
if err != nil {
ctx.ServerError("ReviewRequest", err)
return
}
} else {
- ctx.ServerError("updatePullReviewRequest", fmt.Errorf("%d in %d is not Pull Request", issue.ID, issue.Repo.ID))
+ ctx.Status(403)
+ return
}
}