diff options
author | Stan Hu <stanhu@gmail.com> | 2019-04-15 10:55:45 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-04-15 11:27:33 -0700 |
commit | d3fa9c9539aac42844a297a99ef56254ce1c06a3 (patch) | |
tree | ba94fe9d979a003585ede0c8f499030c731fa3f1 /lib/api/merge_requests.rb | |
parent | 1a50801cd0801d3134b41e96ff2a6b27a96a1047 (diff) | |
download | gitlab-ce-d3fa9c9539aac42844a297a99ef56254ce1c06a3.tar.gz |
Fix remove_source_branch merge request API handlingsh-fix-merge-requests-api-remove-branch-param
Users attempting to set merge requests to `remove_source_branch` to
`false` would encounter an Error 500 because the UpdateService and API
checked `present?`, which would always return `false`. We now just
use `has_key?` to decide whether the parameter is present.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60530
Diffstat (limited to 'lib/api/merge_requests.rb')
-rw-r--r-- | lib/api/merge_requests.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 1cc0ecc6df8..ce85772e4ed 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -336,7 +336,7 @@ module API merge_request = find_merge_request_with_access(params.delete(:merge_request_iid), :update_merge_request) mr_params = declared_params(include_missing: false) - mr_params[:force_remove_source_branch] = mr_params.delete(:remove_source_branch) if mr_params[:remove_source_branch].present? + mr_params[:force_remove_source_branch] = mr_params.delete(:remove_source_branch) if mr_params.has_key?(:remove_source_branch) mr_params = convert_parameters_from_legacy_format(mr_params) merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, mr_params).execute(merge_request) |