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

API: review 2

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