diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 12c9647b..fd741585 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -18,7 +18,17 @@ module Gitlab #create merge_request post ":id/merge_requests" do - + attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title] + project = current_user.projects.find(params[:id]) + merge_request = project.merge_requests.new(attrs) + merge_request.author = current_user + + if merge_request.save + merge_request.reload_code + present merge_request, with: Entities::MergeRequest + else + not_found! + end end #update merge_request