Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
f4ff2ba5
Commit
f4ff2ba5
authored
Feb 01, 2016
by
Rubén Dávila
Committed by
Robert Speicher
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check target branch exists before creating revert MR.
parent
207522f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+5
-0
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
f4ff2ba5
...
@@ -10,6 +10,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -10,6 +10,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:define_show_vars
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
]
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
:define_widget_vars
,
only:
[
:merge
,
:cancel_merge_when_build_succeeds
,
:merge_check
]
before_action
:ensure_ref_fetched
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
]
before_action
:ensure_ref_fetched
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
]
before_action
:check_target_branch_exists
,
only:
[
:revert
]
# Allow read any merge_request
# Allow read any merge_request
before_action
:authorize_read_merge_request!
before_action
:authorize_read_merge_request!
...
@@ -277,6 +278,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -277,6 +278,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
return
render_404
unless
@project
.
merge_requests_enabled
return
render_404
unless
@project
.
merge_requests_enabled
end
end
def
check_target_branch_exists
return
render_404
unless
@merge_request
.
target_branch_exists?
end
def
validates_merge_request
def
validates_merge_request
# If source project was removed (Ex. mr from fork to origin)
# If source project was removed (Ex. mr from fork to origin)
return
invalid_mr
unless
@merge_request
.
source_project
return
invalid_mr
unless
@merge_request
.
source_project
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment