Commit fddbd7b2f076876ec5dd37031aae80748c376cc6

Authored by Dmitriy Zaporozhets
2 parents f3220aba f84d8462

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

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

Conflicts:
	CHANGELOG
CHANGELOG
... ... @@ -22,6 +22,7 @@ v 6.7.0
22 22 - Changed markdown new line behaviour to conform to markdown standards
23 23 - Fix global search
24 24 - Faster authorized_keys rebuilding in `rake gitlab:shell:setup` (requires gitlab-shell 1.8.5)
  25 + - Create and Update MR calls now support the description parameter (Greg Messner)
25 26  
26 27 v 6.6.2
27 28 - Fix 500 error on branch/tag create or remove via UI
... ...
lib/api/merge_requests.rb
... ... @@ -64,6 +64,7 @@ module API
64 64 # target_project - The target project of the merge request defaults to the :id of the project
65 65 # assignee_id - Assignee user ID
66 66 # title (required) - Title of MR
  67 + # description - Description of MR
67 68 #
68 69 # Example:
69 70 # POST /projects/:id/merge_requests
... ... @@ -72,7 +73,7 @@ module API
72 73 set_current_user_for_thread do
73 74 authorize! :write_merge_request, user_project
74 75 required_attributes! [:source_branch, :target_branch, :title]
75   - attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id]
  76 + attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description]
76 77 merge_request = user_project.merge_requests.new(attrs)
77 78 merge_request.author = current_user
78 79 merge_request.source_project = user_project
... ... @@ -105,12 +106,13 @@ module API
105 106 # assignee_id - Assignee user ID
106 107 # title - Title of MR
107 108 # state_event - Status of MR. (close|reopen|merge)
  109 + # description - Description of MR
108 110 # Example:
109 111 # PUT /projects/:id/merge_request/:merge_request_id
110 112 #
111 113 put ":id/merge_request/:merge_request_id" do
112 114 set_current_user_for_thread do
113   - attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event]
  115 + attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event, :description]
114 116 merge_request = user_project.merge_requests.find(params[:merge_request_id])
115 117  
116 118 authorize! :modify_merge_request, merge_request
... ...
spec/requests/api/merge_requests_spec.rb
... ... @@ -92,9 +92,10 @@ describe API::API do
92 92  
93 93 it "should return merge_request" do
94 94 post api("/projects/#{fork_project.id}/merge_requests", user2),
95   - title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user2, target_project_id: project.id
  95 + title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user2, target_project_id: project.id, description: 'Test description for Test merge_request'
96 96 response.status.should == 201
97 97 json_response['title'].should == 'Test merge_request'
  98 + json_response['description'].should == 'Test description for Test merge_request'
98 99 end
99 100  
100 101 it "should not return 422 when source_branch equals target_branch" do
... ... @@ -168,6 +169,12 @@ describe API::API do
168 169 json_response['title'].should == 'New title'
169 170 end
170 171  
  172 + it "should return merge_request" do
  173 + put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), description: "New description"
  174 + response.status.should == 200
  175 + json_response['description'].should == 'New description'
  176 + end
  177 +
171 178 it "should return 422 when source_branch and target_branch are renamed the same" do
172 179 put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user),
173 180 source_branch: "master", target_branch: "master"
... ...