From 11faf8ae72dcdbaff31f97410a3a9319324438fd Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 23 Oct 2019 21:06:17 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/services/merge_requests/build_service.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'app/services/merge_requests') diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb index 214f145d09b..06ee25eac2a 100644 --- a/app/services/merge_requests/build_service.rb +++ b/app/services/merge_requests/build_service.rb @@ -10,13 +10,20 @@ module MergeRequests # TODO: this should handle all quick actions that don't have side effects # https://gitlab.com/gitlab-org/gitlab-foss/issues/53658 merge_quick_actions_into_params!(merge_request, only: [:target_branch]) - merge_request.merge_params['force_remove_source_branch'] = params.delete(:force_remove_source_branch) if params.has_key?(:force_remove_source_branch) # Assign the projects first so we can use policies for `filter_params` merge_request.author = current_user merge_request.source_project = find_source_project merge_request.target_project = find_target_project + # Source project sets the default source branch removal setting + merge_request.merge_params['force_remove_source_branch'] = + if params.key?(:force_remove_source_branch) + params.delete(:force_remove_source_branch) + else + merge_request.source_project.remove_source_branch_after_merge? + end + filter_params(merge_request) # merge_request.assign_attributes(...) below is a Rails -- cgit v1.2.1