Commit 7a18675c authored by Douwe Maan's avatar Douwe Maan

Merge branch 'osw-consistent-values-on-api-merge-status' into 'master'

Return more consistent values for merge_status on MR API

Closes #20639

See merge request gitlab-org/gitlab-ce!16708
parents 86dc5985 395e500f
---
title: Return more consistent values for merge_status on MR APIs
merge_request:
author:
type: fixed
...@@ -507,7 +507,15 @@ module API ...@@ -507,7 +507,15 @@ module API
expose :work_in_progress?, as: :work_in_progress expose :work_in_progress?, as: :work_in_progress
expose :milestone, using: Entities::Milestone expose :milestone, using: Entities::Milestone
expose :merge_when_pipeline_succeeds 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|
merge_request.check_if_can_be_merged
merge_request.merge_status
end
expose :diff_head_sha, as: :sha expose :diff_head_sha, as: :sha
expose :merge_commit_sha expose :merge_commit_sha
expose :user_notes_count expose :user_notes_count
......
...@@ -198,6 +198,8 @@ describe API::MergeRequests do ...@@ -198,6 +198,8 @@ describe API::MergeRequests do
create(:merge_request, state: 'closed', milestone: milestone1, author: user, assignee: user, source_project: project, target_project: project, title: "Test", created_at: base_time) create(:merge_request, state: 'closed', milestone: milestone1, author: user, assignee: user, source_project: project, target_project: project, title: "Test", created_at: base_time)
create(:merge_request, milestone: milestone1, author: user, assignee: user, source_project: project, target_project: project, title: "Test", created_at: base_time)
expect do expect do
get api("/projects/#{project.id}/merge_requests", user) get api("/projects/#{project.id}/merge_requests", user)
end.not_to exceed_query_limit(control) end.not_to exceed_query_limit(control)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment