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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
4775fb9e
Commit
4775fb9e
authored
Jun 05, 2018
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Render 'invalid' if #target_branch_missing?
parent
d87552a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
18 deletions
+7
-18
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+7
-18
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
4775fb9e
...
...
@@ -28,15 +28,14 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
end
def
show
validates_merge_request
# Return if the response has already been rendered
return
if
response_body
close_merge_request_if_no_source_project
mark_merge_request_mergeable
respond_to
do
|
format
|
format
.
html
do
# use next to appease Rubocop
next
render
(
'invalid'
)
if
target_branch_missing?
# Build a note object for comment form
@note
=
@project
.
notes
.
new
(
noteable:
@merge_request
)
...
...
@@ -234,20 +233,6 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
alias_method
:issuable
,
:merge_request
alias_method
:awardable
,
:merge_request
def
validates_merge_request
# Show git not found page
# if there is no saved commits between source & target branch
if
@merge_request
.
has_no_commits?
# and if target branch doesn't exist
return
invalid_mr
unless
@merge_request
.
target_branch_exists?
end
end
def
invalid_mr
# Render special view for MR with removed target branch
render
'invalid'
end
def
merge_params
params
.
permit
(
merge_params_attributes
)
end
...
...
@@ -269,6 +254,10 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
private
def
target_branch_missing?
@merge_request
.
has_no_commits?
&&
!
@merge_request
.
target_branch_exists?
end
def
mark_merge_request_mergeable
@merge_request
.
check_if_can_be_merged
end
...
...
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