diff options
author | Rémy Coutable <remy@rymai.me> | 2016-06-07 14:01:34 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-06-10 15:36:57 +0300 |
commit | 6dff7c1771e0cfeb6906244649b3683090bc2929 (patch) | |
tree | acff551905a3371e709b3e453c0b6bd6cfa6808d /lib | |
parent | 07dbd6b3884c4f188b2c3f29dd7419791f1051eb (diff) |
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')
-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) |