diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-01-24 18:09:16 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-01-24 18:09:16 +0300 |
commit | 9f5390d81d63ae4186554aced85094a4b08e1aff (patch) | |
tree | 7073d9694f859e63a63b13e320e793ef9c6c0ee4 /lib | |
parent | c28ffa1da3aaed0c189a1787a17ed2c944882f09 (diff) | |
parent | 38ef39550c18124f7a62568900ffff799abf5b97 (diff) |
Merge branch 'osw-updates-merge-status-on-api-actions' into 'master'
Return more consistent values for merge_status on V4 MR APIs
Closes #20639
See merge request gitlab-org/gitlab-ce!16626
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 7b9a80a234b..5b470bd3479 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -507,7 +507,16 @@ module API expose :work_in_progress?, as: :work_in_progress expose :milestone, using: Entities::Milestone expose :merge_when_pipeline_succeeds - expose :merge_status + + # Ideally we should deprecate `MergeRequest#merge_status` exposure and + # use `MergeRequest#mergeable?` instead (boolean). + # See https://gitlab.com/gitlab-org/gitlab-ce/issues/42344 for more + # information. + expose :merge_status do |merge_request| + # In order to avoid having a breaking change for users, we keep returning the + # expected values from MergeRequest#merge_status state machine. + merge_request.mergeable? ? 'can_be_merged' : 'cannot_be_merged' + end expose :diff_head_sha, as: :sha expose :merge_commit_sha expose :user_notes_count |