API: review 2
This commit is contained in:
parent
56bf829c75
commit
4281de3640
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue