mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-20 14:11:11 +00:00
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.
This commit is contained in:
@ -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)
|
||||||
|
@ -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
|
||||||
|
Reference in New Issue
Block a user