Commit fddbd7b2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'issue-110' of https://gitlab.com/gmessner/gitlab-ce into gmessner/gitlab-ce-issue-110

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Conflicts:
	CHANGELOG
parents f3220aba f84d8462
...@@ -22,6 +22,7 @@ v 6.7.0 ...@@ -22,6 +22,7 @@ v 6.7.0
- Changed markdown new line behaviour to conform to markdown standards - Changed markdown new line behaviour to conform to markdown standards
- Fix global search - Fix global search
- Faster authorized_keys rebuilding in `rake gitlab:shell:setup` (requires gitlab-shell 1.8.5) - Faster authorized_keys rebuilding in `rake gitlab:shell:setup` (requires gitlab-shell 1.8.5)
- Create and Update MR calls now support the description parameter (Greg Messner)
v 6.6.2 v 6.6.2
- Fix 500 error on branch/tag create or remove via UI - Fix 500 error on branch/tag create or remove via UI
......
...@@ -64,6 +64,7 @@ module API ...@@ -64,6 +64,7 @@ module API
# target_project - The target project of the merge request defaults to the :id of the project # target_project - The target project of the merge request defaults to the :id of the project
# assignee_id - Assignee user ID # assignee_id - Assignee user ID
# title (required) - Title of MR # title (required) - Title of MR
# description - Description of MR
# #
# Example: # Example:
# POST /projects/:id/merge_requests # POST /projects/:id/merge_requests
...@@ -72,7 +73,7 @@ module API ...@@ -72,7 +73,7 @@ module API
set_current_user_for_thread do set_current_user_for_thread do
authorize! :write_merge_request, user_project authorize! :write_merge_request, user_project
required_attributes! [:source_branch, :target_branch, :title] required_attributes! [:source_branch, :target_branch, :title]
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id] attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description]
merge_request = user_project.merge_requests.new(attrs) merge_request = user_project.merge_requests.new(attrs)
merge_request.author = current_user merge_request.author = current_user
merge_request.source_project = user_project merge_request.source_project = user_project
...@@ -105,12 +106,13 @@ module API ...@@ -105,12 +106,13 @@ module API
# assignee_id - Assignee user ID # assignee_id - Assignee user ID
# title - Title of MR # title - Title of MR
# state_event - Status of MR. (close|reopen|merge) # state_event - Status of MR. (close|reopen|merge)
# description - Description of MR
# Example: # Example:
# PUT /projects/:id/merge_request/:merge_request_id # PUT /projects/:id/merge_request/:merge_request_id
# #
put ":id/merge_request/:merge_request_id" do put ":id/merge_request/:merge_request_id" do
set_current_user_for_thread do set_current_user_for_thread do
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event] attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event, :description]
merge_request = user_project.merge_requests.find(params[:merge_request_id]) merge_request = user_project.merge_requests.find(params[:merge_request_id])
authorize! :modify_merge_request, merge_request authorize! :modify_merge_request, merge_request
......
...@@ -92,9 +92,10 @@ describe API::API do ...@@ -92,9 +92,10 @@ describe API::API do
it "should return merge_request" do it "should return merge_request" do
post api("/projects/#{fork_project.id}/merge_requests", user2), post api("/projects/#{fork_project.id}/merge_requests", user2),
title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user2, target_project_id: project.id title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user2, target_project_id: project.id, description: 'Test description for Test merge_request'
response.status.should == 201 response.status.should == 201
json_response['title'].should == 'Test merge_request' json_response['title'].should == 'Test merge_request'
json_response['description'].should == 'Test description for Test merge_request'
end end
it "should not return 422 when source_branch equals target_branch" do it "should not return 422 when source_branch equals target_branch" do
...@@ -168,6 +169,12 @@ describe API::API do ...@@ -168,6 +169,12 @@ describe API::API do
json_response['title'].should == 'New title' json_response['title'].should == 'New title'
end end
it "should return merge_request" do
put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), description: "New description"
response.status.should == 200
json_response['description'].should == 'New description'
end
it "should return 422 when source_branch and target_branch are renamed the same" do it "should return 422 when source_branch and target_branch are renamed the same" do
put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user),
source_branch: "master", target_branch: "master" source_branch: "master", target_branch: "master"
......
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