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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
13d2ec2d
Commit
13d2ec2d
authored
Sep 26, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Callback close_merge_request_without_source_project
parent
cb34e97d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+8
-7
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
13d2ec2d
...
...
@@ -18,6 +18,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
before_action
:define_commit_vars
,
only:
[
:diffs
]
before_action
:define_diff_comment_vars
,
only:
[
:diffs
]
before_action
:ensure_ref_fetched
,
only:
[
:show
,
:diffs
,
:commits
,
:builds
,
:conflicts
,
:pipelines
]
before_action
:close_merge_request_without_source_project
,
only:
[
:show
]
# Allow read any merge_request
before_action
:authorize_read_merge_request!
...
...
@@ -416,12 +417,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def
validates_merge_request
# If source project was removed and merge request for some reason
# wasn't closed (Ex. MR from fork to origin) merge request will be closed
if
!
@merge_request
.
source_project
&&
@merge_request
.
open?
@merge_request
.
close
end
# Show git not found page
# if there is no saved commits between source & target branch
if
@merge_request
.
commits
.
blank?
...
...
@@ -496,7 +491,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def
invalid_mr
# Render special view for MR with removed
source or
target branch
# Render special view for MR with removed target branch
render
'invalid'
end
...
...
@@ -538,4 +533,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@diff_notes_disabled
=
!
@merge_request_diff
.
latest?
@diffs
=
@merge_request_diff
.
diffs
(
diff_options
)
end
def
close_merge_request_without_source_project
if
!
@merge_request
.
source_project
&&
@merge_request
.
open?
@merge_request
.
close
end
end
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