summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2019-05-07 16:06:53 +0000
committerJames Lopez <james@gitlab.com>2019-05-07 16:06:53 +0000
commit47e5eedc5c3b09d631143848228e7f70388c6f85 (patch)
treec23954af03947e8af936e2c6428340c28dbf3aab /lib
parentf0ff33d8bf3c0fd2dae4f6c762f161b127aa88d7 (diff)
parent29f9d92642539eaa04bdb485425d6f1cd3b459fd (diff)
downloadgitlab-ce-47e5eedc5c3b09d631143848228e7f70388c6f85.tar.gz
Merge branch '55127-add-delay-after-mr-creation-for-async-tasks-to-complete' into 'master'
Confirm pipeline existence when accepting a MR Closes #55127 See merge request gitlab-org/gitlab-ce!27978
Diffstat (limited to 'lib')
-rw-r--r--lib/api/merge_requests.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index ce85772e4ed..daa98c22e5e 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -367,6 +367,10 @@ module API
merge_request = find_project_merge_request(params[:merge_request_iid])
merge_when_pipeline_succeeds = to_boolean(params[:merge_when_pipeline_succeeds])
+ if merge_when_pipeline_succeeds || merge_request.merge_when_pipeline_succeeds
+ render_api_error!('Not allowed: pipeline does not exist', 405) unless merge_request.head_pipeline
+ end
+
# Merge request can not be merged
# because user dont have permissions to push into target branch
unauthorized! unless merge_request.can_be_merged_by?(current_user)