aboutsummaryrefslogtreecommitdiffstats
path: root/routers/private/hook_pre_receive.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-03-31 16:53:08 +0200
committerGitHub <noreply@github.com>2022-03-31 16:53:08 +0200
commit9c349a4277926bfd3ff0360301765ad7abd9f10b (patch)
tree6a3859850e61aca261738438deaf6075b1d30612 /routers/private/hook_pre_receive.go
parentf6145a69c4814d9aaaeac5d73c743b2f65bc586c (diff)
downloadgitea-9c349a4277926bfd3ff0360301765ad7abd9f10b.tar.gz
gitea-9c349a4277926bfd3ff0360301765ad7abd9f10b.zip
Move checks for pulls before merge into own function (#19271)
This make checks in one single place so they dont differ and maintainer can not forget a check in one place while adding it to the other .... ( as it's atm ) Fix: * The API does ignore issue dependencies where Web does not * The API checks if "IsSignedIfRequired" where Web does not - UI probably do but nothing will some to craft custom requests * Default merge message is crafted a bit different between API and Web if not set on specific cases ...
Diffstat (limited to 'routers/private/hook_pre_receive.go')
-rw-r--r--routers/private/hook_pre_receive.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/routers/private/hook_pre_receive.go b/routers/private/hook_pre_receive.go
index c6ea422287..f3f876edca 100644
--- a/routers/private/hook_pre_receive.go
+++ b/routers/private/hook_pre_receive.go
@@ -340,7 +340,7 @@ func preReceiveBranch(ctx *preReceiveContext, oldCommitID, newCommitID, refFullN
// Check all status checks and reviews are ok
if err := pull_service.CheckPRReadyToMerge(ctx, pr, true); err != nil {
- if models.IsErrNotAllowedToMerge(err) {
+ if models.IsErrDisallowedToMerge(err) {
log.Warn("Forbidden: User %d is not allowed push to protected branch %s in %-v and pr #%d is not ready to be merged: %s", ctx.opts.UserID, branchName, repo, pr.Index, err.Error())
ctx.JSON(http.StatusForbidden, private.Response{
Err: fmt.Sprintf("Not allowed to push to protected branch %s and pr #%d is not ready to be merged: %s", branchName, ctx.opts.PullRequestID, err.Error()),