Commit ab92551b authored by Rémy Coutable's avatar Rémy Coutable

Merge branch...

Merge branch '23234-deleting-a-milestone-removes-source-branch-deletion-options-of-associated-merge-requests' into 'master'

Maintain "force_remove_source_branch" options on Merge Request unless specified

Fixes a problem where Merge Requests were losing the state associated with the flag to remove the source branch upon merge

* Closes #23234
* Closes #23191
* Closes #19351

See merge request !6817
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 70b24e49
...@@ -6,6 +6,7 @@ v 8.12.7 ...@@ -6,6 +6,7 @@ v 8.12.7
- Use gitlab-markup gem instead of github-markup to fix `.rst` file rendering. !6659 - Use gitlab-markup gem instead of github-markup to fix `.rst` file rendering. !6659
- Prevent flash alert text from being obscured when container is fluid. !6694 - Prevent flash alert text from being obscured when container is fluid. !6694
- Fix JS bug with select2 because of missing `data-field` attribute in select box. !6812 - Fix JS bug with select2 because of missing `data-field` attribute in select box. !6812
- Do not alter 'force_remove_source_branch' options on MergeRequest unless specified. !6817
v 8.12.6 v 8.12.6
- Update mailroom to 0.8.1 in Gemfile.lock !6814 - Update mailroom to 0.8.1 in Gemfile.lock !6814
......
...@@ -15,7 +15,9 @@ module MergeRequests ...@@ -15,7 +15,9 @@ module MergeRequests
params.except!(:target_branch, :force_remove_source_branch) params.except!(:target_branch, :force_remove_source_branch)
end end
if params[:force_remove_source_branch].present?
merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch) merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch)
end
update(merge_request) update(merge_request)
end end
......
...@@ -104,6 +104,18 @@ describe MergeRequests::UpdateService, services: true do ...@@ -104,6 +104,18 @@ describe MergeRequests::UpdateService, services: true do
expect(note).not_to be_nil expect(note).not_to be_nil
expect(note.note).to eq 'Target branch changed from `master` to `target`' expect(note.note).to eq 'Target branch changed from `master` to `target`'
end end
context 'when not including source branch removal options' do
before do
opts.delete(:force_remove_source_branch)
end
it 'maintains the original options' do
update_merge_request(opts)
expect(@merge_request.merge_params["force_remove_source_branch"]).to eq("1")
end
end
end end
context 'todos' do context 'todos' 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