Commit d3c24373 authored by Rubén Dávila's avatar Rubén Dávila Committed by Robert Speicher

Add new endpoint and button to revert merge. #3409

parent 96158aa6
...@@ -191,6 +191,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -191,6 +191,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
end end
def revert
redirect_to new_namespace_project_merge_request_url(@project.namespace, @project)
end
def branch_from def branch_from
#This is always source #This is always source
@source_project = @merge_request.nil? ? @project : @merge_request.source_project @source_project = @merge_request.nil? ? @project : @merge_request.source_project
......
...@@ -17,4 +17,6 @@ ...@@ -17,4 +17,6 @@
%i.fa.fa-pencil-square-o %i.fa.fa-pencil-square-o
Edit Edit
- if @merge_request.closed? - if @merge_request.closed?
= link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: 'btn btn-nr btn-grouped btn-reopen reopen-mr-link', title: 'Reopen merge request' = link_to 'Reopen', merge_request_path(@merge_request, merge_request: {state_event: :reopen }), method: :put, class: 'btn btn-nr btn-grouped btn-reopen reopen-mr-link', title: "Reopen merge request"
- if @merge_request.merged?
= link_to 'Revert', revert_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), method: :post, class: "btn btn-grouped btn-close", title: "Revert merge request"
...@@ -590,6 +590,7 @@ Rails.application.routes.draw do ...@@ -590,6 +590,7 @@ Rails.application.routes.draw do
post :cancel_merge_when_build_succeeds post :cancel_merge_when_build_succeeds
get :ci_status get :ci_status
post :toggle_subscription post :toggle_subscription
post :revert
end end
collection do collection do
......
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