Commit 68ea2f93 authored by http://jneen.net/'s avatar http://jneen.net/ Committed by Bryce Johnson

add json actions for approvals/approve/unapprove

parent 4d1497ca
......@@ -496,11 +496,29 @@ class Projects::MergeRequestsController < Projects::ApplicationController
new(project, current_user).
execute(@merge_request)
redirect_to merge_request_path(@merge_request)
render_approvals_json
end
def approvals
render_approvals_json
end
def unapprove
if merge_request.has_approved?(current_user)
MergeRequests::RemoveApprovalService.
new(project, current_user).
execute(@merge_request)
end
render_approvals_json
end
protected
def render_approvals_json
render json: API::Entities::MergeRequestApprovals.new(@merge_request)
end
def selected_target_project
if @project.id.to_s == params[:target_project_id] || @project.forked_project_link.nil?
@project
......
......@@ -96,7 +96,10 @@ constraints(ProjectUrlConstrainer.new) do
post :toggle_subscription
## EE-specific
post :approve
get :approvals
post :approvals, to: :approve
delete :approvals, to: :unapprove
post :rebase
## EE-specific
......
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