Commit b3e989b0 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

## What does this MR do?

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
parents 2362dfee 3c476ee6
......@@ -33,6 +33,7 @@ v 8.13.0 (unreleased)
- Update Gitlab Shell to fix some problems with moving projects between storages
- Cache rendered markdown in the database, rather than Redis
- Avoid database queries on Banzai::ReferenceParser::BaseParser for nodes without references
- Do not alter 'force_remove_source_branch' options on MergeRequest unless specified
- Simplify Mentionable concern instance methods
- API: Ability to retrieve version information (Robert Schilling)
- Fix permission for setting an issue's due date
......
......@@ -15,7 +15,10 @@ module MergeRequests
params.except!(:target_branch, :force_remove_source_branch)
end
merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch)
if params[:force_remove_source_branch].present?
merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch)
end
handle_wip_event(merge_request)
update(merge_request)
end
......
......@@ -105,6 +105,18 @@ describe MergeRequests::UpdateService, services: true do
expect(note).not_to be_nil
expect(note.note).to eq 'Target branch changed from `master` to `target`'
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
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