Commit 611fe8c1 authored by Brian Kabiro's avatar Brian Kabiro Committed by Bob Van Landuyt

Return merge-request state in API

- expose `has_conflicts` and `mergeable_discussions_state` in API
- add unit tests for the change
parent 97944f44
---
title: Expose mergeable state of a merge request
merge_request: 18888
author: briankabiro
type: added
......@@ -304,7 +304,9 @@ Parameters:
"task_completion_status":{
"count":0,
"completed_count":0
}
},
"has_conflicts": false,
"blocking_discussions_resolved": true
}
]
```
......@@ -453,7 +455,9 @@ Parameters:
"task_completion_status":{
"count":0,
"completed_count":0
}
},
"has_conflicts": false,
"blocking_discussions_resolved": true
}
]
```
......@@ -606,7 +610,9 @@ Parameters:
"task_completion_status":{
"count":0,
"completed_count":0
}
},
"has_conflicts": false,
"blocking_discussions_resolved": true
}
```
......
......@@ -777,6 +777,10 @@ module API
expose :squash
expose :task_completion_status
expose :cannot_be_merged?, as: :has_conflicts
expose :mergeable_discussions_state?, as: :blocking_discussions_resolved
end
class MergeRequest < MergeRequestBasic
......
......@@ -775,6 +775,8 @@ describe API::MergeRequests do
expect(json_response['merge_error']).to eq(merge_request.merge_error)
expect(json_response['user']['can_merge']).to be_truthy
expect(json_response).not_to include('rebase_in_progress')
expect(json_response['has_conflicts']).to be_falsy
expect(json_response['blocking_discussions_resolved']).to be_truthy
end
it 'exposes description and title html when render_html is true' do
......
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