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
14a6cebc
Commit
14a6cebc
authored
Oct 03, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store the name of a project that's a root of a fork network
So we can keep showing it to a user in his project page.
parent
f90b27da
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
app/services/projects/destroy_service.rb
app/services/projects/destroy_service.rb
+7
-0
spec/services/projects/destroy_service_spec.rb
spec/services/projects/destroy_service_spec.rb
+13
-0
No files found.
app/services/projects/destroy_service.rb
View file @
14a6cebc
...
@@ -22,6 +22,13 @@ module Projects
...
@@ -22,6 +22,13 @@ module Projects
Projects
::
UnlinkForkService
.
new
(
project
,
current_user
).
execute
Projects
::
UnlinkForkService
.
new
(
project
,
current_user
).
execute
# The project is not necessarily a fork, so update the fork network originating
# from this project
if
fork_network
=
project
.
root_of_fork_network
fork_network
.
update
(
root_project:
nil
,
deleted_root_project_name:
project
.
full_name
)
end
attempt_destroy_transaction
(
project
)
attempt_destroy_transaction
(
project
)
system_hook_service
.
execute_hooks_for
(
project
,
:destroy
)
system_hook_service
.
execute_hooks_for
(
project
,
:destroy
)
...
...
spec/services/projects/destroy_service_spec.rb
View file @
14a6cebc
...
@@ -212,6 +212,19 @@ describe Projects::DestroyService do
...
@@ -212,6 +212,19 @@ describe Projects::DestroyService do
end
end
end
end
context
'as the root of a fork network'
do
let!
(
:fork_network
)
{
create
(
:fork_network
,
root_project:
project
)
}
it
'updates the fork network with the project name'
do
destroy_project
(
project
,
user
)
fork_network
.
reload
expect
(
fork_network
.
deleted_root_project_name
).
to
eq
(
project
.
full_name
)
expect
(
fork_network
.
root_project
).
to
be_nil
end
end
def
destroy_project
(
project
,
user
,
params
=
{})
def
destroy_project
(
project
,
user
,
params
=
{})
if
async
if
async
Projects
::
DestroyService
.
new
(
project
,
user
,
params
).
async_execute
Projects
::
DestroyService
.
new
(
project
,
user
,
params
).
async_execute
...
...
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