Commit 4281de36 authored by Valeriy Sizov's avatar Valeriy Sizov

API: review 2

parent 56bf829c
......@@ -65,8 +65,7 @@ module Gitlab
end
class MergeRequest < Grape::Entity
expose :id, :target_branch, :source_branch, :project_id,
:title, :closed, :merged
expose :id, :target_branch, :source_branch, :project_id, :title, :closed, :merged
expose :author, :assignee, using: Entities::UserBasic
end
......
......@@ -50,12 +50,12 @@ module Gitlab
# POST /projects/:id/merge_requests
#
post ":id/merge_requests" do
authorize! :write_merge_request, user_project
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title]
merge_request = user_project.merge_requests.new(attrs)
merge_request.author = current_user
authorize! :write_merge_request, user_project
if merge_request.save
merge_request.reload_code
present merge_request, with: Entities::MergeRequest
......@@ -105,6 +105,7 @@ module Gitlab
merge_request = user_project.merge_requests.find(params[:merge_request_id])
note = merge_request.notes.new(note: params[:note], project_id: user_project.id)
note.author = current_user
if note.save
present note, with: Entities::Note
else
......
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