diff options
author | Rémy Coutable <remy@rymai.me> | 2016-06-07 13:01:34 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-10 14:36:57 +0200 |
commit | 6dff7c1771e0cfeb6906244649b3683090bc2929 (patch) | |
tree | acff551905a3371e709b3e453c0b6bd6cfa6808d /lib/api/merge_requests.rb | |
parent | 07dbd6b3884c4f188b2c3f29dd7419791f1051eb (diff) | |
download | gitlab-ce-6dff7c1771e0cfeb6906244649b3683090bc2929.tar.gz |
Improve initial implementation of the 'only_allow_merge_if_build_succeeds.rb' feature
Based on the feedback from reviewers.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/api/merge_requests.rb')
-rw-r--r-- | lib/api/merge_requests.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 5822e19cd44..24df3e397e0 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -228,11 +228,10 @@ module API # 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) - not_allowed! if !merge_request.open? || merge_request.work_in_progress? || merge_request.cannot_be_merged_because_build_failed? - merge_request.check_if_can_be_merged + not_allowed! unless merge_request.mergeable_state? - render_api_error!('Branch cannot be merged', 406) unless merge_request.can_be_merged? + render_api_error!('Branch cannot be merged', 406) unless merge_request.mergeable? if params[:sha] && merge_request.source_sha != params[:sha] render_api_error!("SHA does not match HEAD of source branch: #{merge_request.source_sha}", 409) |