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
09cded29
Commit
09cded29
authored
Sep 02, 2016
by
Katarzyna Kobierska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checks if deleting forked project closed all open merge requests
parent
8c77a1fb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-2
app/models/merge_request.rb
app/models/merge_request.rb
+1
-1
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+5
-3
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
09cded29
...
@@ -429,7 +429,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -429,7 +429,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
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
# Show git not found page
# Show git not found page
# if there is no saved commits between source & target branch
# if there is no saved commits between source & target branch
...
@@ -438,7 +438,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
...
@@ -438,7 +438,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController
return
invalid_mr
unless
@merge_request
.
target_branch_exists?
return
invalid_mr
unless
@merge_request
.
target_branch_exists?
# or if source branch doesn't exist
# or if source branch doesn't exist
return
invalid_mr
unless
@merge_request
.
source_branch_exists?
#
return invalid_mr unless @merge_request.source_branch_exists?
end
end
end
end
...
...
app/models/merge_request.rb
View file @
09cded29
...
@@ -313,7 +313,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -313,7 +313,7 @@ class MergeRequest < ActiveRecord::Base
end
end
def
closed_without_fork?
def
closed_without_fork?
closed?
&&
forked_source_project_missing?
closed?
&&
(
forked_source_project_missing?
||
!
source_project
)
end
end
def
forked_source_project_missing?
def
forked_source_project_missing?
...
...
spec/controllers/projects_controller_spec.rb
View file @
09cded29
...
@@ -192,10 +192,12 @@ describe ProjectsController do
...
@@ -192,10 +192,12 @@ describe ProjectsController do
end
end
it
"closes all related merge requests"
do
it
"closes all related merge requests"
do
fork_project
.
destroy
project
.
merge_requests
<<
merge_request
sign_in
(
admin
)
delete
:destroy
,
namespace_id:
fork_project
.
namespace
.
path
,
id:
fork_project
.
path
expect
(
fork_project
.
destroyed?
).
to
be_truthy
expect
(
merge_request
.
reload
.
state
).
to
eq
(
'closed'
)
expect
(
merge_request
.
state
).
to
eq
(
'closed'
)
end
end
end
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