API: merge request: post comment call

This commit is contained in:
Valeriy Sizov 2012-10-21 19:48:56 +03:00
parent b32a8eea93
commit 93e8d426c5
2 changed files with 17 additions and 0 deletions

View file

@ -69,5 +69,10 @@ module Gitlab
:title, :closed, :merged
expose :author, :assignee, using: Entities::UserBasic
end
class Note < Grape::Entity
expose :author, using: Entities::UserBasic
expose :note
end
end
end

View file

@ -52,6 +52,18 @@ module Gitlab
end
end
#post comment to merge request
post ":id/merge_request/:merge_request_id/comments" do
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
not_found!
end
end
end
end
end