Commit 93301dd2 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'remove-branch-api' into 'master'

api: expose {should,force}_remove_source_branch

## What does this MR do?

Exposes the `should_remove_source_branch` and `force_remove_source_branch` booleans via the API.

## Are there points in the code the reviewer needs to double check?

I don't think so.

## Why was this MR needed?

See the commit message.

## What are the relevant issue numbers?

N/A

## Screenshots (if relevant)

N/A

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [x] API support added
- Tests
  - [x] Added for this feature/bug
  - [ ] All builds are passing
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

See merge request !5184
parents b7ba5fa0 eac19b28
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.10.0 (unreleased) v 8.10.0 (unreleased)
- Expose {should,force}_remove_source_branch (Ben Boeckel)
- Fix commit builds API, return all builds for all pipelines for given commit. !4849 - Fix commit builds API, return all builds for all pipelines for given commit. !4849
- Replace Haml with Hamlit to make view rendering faster. !3666 - Replace Haml with Hamlit to make view rendering faster. !3666
- Refactor repository paths handling to allow multiple git mount points - Refactor repository paths handling to allow multiple git mount points
......
...@@ -68,7 +68,9 @@ Parameters: ...@@ -68,7 +68,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : false, "subscribed" : false,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
] ]
``` ```
...@@ -132,7 +134,9 @@ Parameters: ...@@ -132,7 +134,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -233,6 +237,8 @@ Parameters: ...@@ -233,6 +237,8 @@ Parameters:
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1, "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false,
"changes": [ "changes": [
{ {
"old_path": "VERSION", "old_path": "VERSION",
...@@ -312,7 +318,9 @@ Parameters: ...@@ -312,7 +318,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 0 "user_notes_count": 0,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -383,7 +391,9 @@ Parameters: ...@@ -383,7 +391,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -481,7 +491,9 @@ Parameters: ...@@ -481,7 +491,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -547,7 +559,9 @@ Parameters: ...@@ -547,7 +559,9 @@ Parameters:
"merge_when_build_succeeds": true, "merge_when_build_succeeds": true,
"merge_status": "can_be_merged", "merge_status": "can_be_merged",
"subscribed" : true, "subscribed" : true,
"user_notes_count": 1 "user_notes_count": 1,
"should_remove_source_branch": true,
"force_remove_source_branch": false
} }
``` ```
...@@ -866,7 +880,9 @@ Example response: ...@@ -866,7 +880,9 @@ Example response:
"merge_when_build_succeeds": false, "merge_when_build_succeeds": false,
"merge_status": "unchecked", "merge_status": "unchecked",
"subscribed": true, "subscribed": true,
"user_notes_count": 7 "user_notes_count": 7,
"should_remove_source_branch": true,
"force_remove_source_branch": false
}, },
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-ci/merge_requests/7", "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ci/merge_requests/7",
"body": "Et voluptas laudantium minus nihil recusandae ut accusamus earum aut non.", "body": "Et voluptas laudantium minus nihil recusandae ut accusamus earum aut non.",
......
...@@ -207,6 +207,8 @@ module API ...@@ -207,6 +207,8 @@ module API
merge_request.subscribed?(options[:current_user]) merge_request.subscribed?(options[:current_user])
end end
expose :user_notes_count expose :user_notes_count
expose :should_remove_source_branch?, as: :should_remove_source_branch
expose :force_remove_source_branch?, as: :force_remove_source_branch
end end
class MergeRequestChanges < MergeRequest class MergeRequestChanges < MergeRequest
......
...@@ -138,6 +138,8 @@ describe API::API, api: true do ...@@ -138,6 +138,8 @@ describe API::API, api: true do
expect(json_response['work_in_progress']).to be_falsy expect(json_response['work_in_progress']).to be_falsy
expect(json_response['merge_when_build_succeeds']).to be_falsy expect(json_response['merge_when_build_succeeds']).to be_falsy
expect(json_response['merge_status']).to eq('can_be_merged') expect(json_response['merge_status']).to eq('can_be_merged')
expect(json_response['should_close_merge_request']).to be_falsy
expect(json_response['force_close_merge_request']).to be_falsy
end end
it "should return merge_request" do it "should return merge_request" do
...@@ -147,6 +149,8 @@ describe API::API, api: true do ...@@ -147,6 +149,8 @@ describe API::API, api: true do
expect(json_response['iid']).to eq(merge_request.iid) expect(json_response['iid']).to eq(merge_request.iid)
expect(json_response['work_in_progress']).to eq(false) expect(json_response['work_in_progress']).to eq(false)
expect(json_response['merge_status']).to eq('can_be_merged') expect(json_response['merge_status']).to eq('can_be_merged')
expect(json_response['should_close_merge_request']).to be_falsy
expect(json_response['force_close_merge_request']).to be_falsy
end end
it 'should return merge_request by iid' do it 'should return merge_request by iid' 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