Skip to content
Snippets Groups Projects
Commit f4ff2ba5 authored by Rubén Dávila's avatar Rubén Dávila Committed by Robert Speicher
Browse files

Check target branch exists before creating revert MR.

parent 207522f9
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -10,6 +10,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action :define_show_vars, only: [:show, :diffs, :commits, :builds]
before_action :define_widget_vars, only: [:merge, :cancel_merge_when_build_succeeds, :merge_check]
before_action :ensure_ref_fetched, only: [:show, :diffs, :commits, :builds]
before_action :check_target_branch_exists, only: [:revert]
 
# Allow read any merge_request
before_action :authorize_read_merge_request!
Loading
Loading
@@ -277,6 +278,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
return render_404 unless @project.merge_requests_enabled
end
 
def check_target_branch_exists
return render_404 unless @merge_request.target_branch_exists?
end
def validates_merge_request
# If source project was removed (Ex. mr from fork to origin)
return invalid_mr unless @merge_request.source_project
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment