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
Jérome Perrin
gitlab-ce
Commits
25edb070
Commit
25edb070
authored
Sep 22, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close merge request if open without source project
parent
dde96231
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+4
-2
spec/views/projects/merge_requests/show.html.haml_spec.rb
spec/views/projects/merge_requests/show.html.haml_spec.rb
+13
-0
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
25edb070
...
...
@@ -417,8 +417,10 @@ class Projects::MergeRequestsController < Projects::ApplicationController
def
validates_merge_request
# If source project was removed and merge request for some reason
# wasn't close (Ex. mr from fork to origin)
return
invalid_mr
if
!
@merge_request
.
source_project
&&
@merge_request
.
open?
# wasn't close (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
...
...
spec/views/projects/merge_requests/show.html.haml_spec.rb
View file @
25edb070
...
...
@@ -41,4 +41,17 @@ describe 'projects/merge_requests/show.html.haml' do
expect
(
rendered
).
to
have_css
(
'a'
,
visible:
false
,
text:
'Close'
)
end
end
context
'when the merge request is open'
do
it
'closes open merge request'
do
closed_merge_request
.
update_attributes
(
state:
'open'
)
fork_project
.
destroy
render
expect
(
closed_merge_request
.
reload
.
state
).
to
eq
(
'closed'
)
expect
(
rendered
).
to
have_css
(
'a'
,
visible:
false
,
text:
'Reopen'
)
expect
(
rendered
).
to
have_css
(
'a'
,
visible:
false
,
text:
'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