diff options
author | Stan Hu <stanhu@gmail.com> | 2015-05-29 19:40:35 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-05-29 19:40:35 +0300 |
commit | 85145d1d77ed919949d59c83cccecd43789cc781 (patch) | |
tree | 46c2cfbb97f3206ef4fa4a820ef913fbc7278d8d /lib | |
parent | 467d7f6720c6b85d2b1559bb7263dde0f448402e (diff) |
Disable changing of the source branch in merge request update API
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/merge_requests.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 2216a12a87a..d835dce2ded 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -137,7 +137,6 @@ module API # Parameters: # id (required) - The ID of a project # merge_request_id (required) - ID of MR - # source_branch - The source branch # target_branch - The target branch # assignee_id - Assignee user ID # title - Title of MR @@ -148,10 +147,15 @@ module API # PUT /projects/:id/merge_request/:merge_request_id # put ":id/merge_request/:merge_request_id" do - attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event, :description] + attrs = attributes_for_keys [:target_branch, :assignee_id, :title, :state_event, :description] merge_request = user_project.merge_requests.find(params[:merge_request_id]) authorize! :modify_merge_request, merge_request + # Ensure source_branch is not specified + if params[:source_branch].present? + render_api_error!('Source branch cannot be changed', 400) + end + # Validate label names in advance if (errors = validate_label_params(params)).any? render_api_error!({ labels: errors }, 400) |