From 0de85b53194f582e8fc3267f14b7a5038440e401 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Thu, 17 Aug 2017 11:15:57 +0100 Subject: Remove a wat in NamespacelessProjectDestroyWorker --- app/models/project.rb | 3 +++ app/workers/namespaceless_project_destroy_worker.rb | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/models/project.rb b/app/models/project.rb index 22b347cc8f9..5416786b4aa 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1224,6 +1224,9 @@ class Project < ActiveRecord::Base # TODO: what to do here when not using Legacy Storage? Do we still need to rename and delay removal? def remove_pages + # Projects with a missing namespace cannot have their pages removed + return unless namespace + ::Projects::UpdatePagesConfigurationService.new(self).execute # 1. We rename pages to temporary directory diff --git a/app/workers/namespaceless_project_destroy_worker.rb b/app/workers/namespaceless_project_destroy_worker.rb index bfae0c77700..a9073742ff7 100644 --- a/app/workers/namespaceless_project_destroy_worker.rb +++ b/app/workers/namespaceless_project_destroy_worker.rb @@ -24,10 +24,6 @@ class NamespacelessProjectDestroyWorker unlink_fork(project) if project.forked? - # Override Project#remove_pages for this instance so it doesn't do anything - def project.remove_pages - end - project.destroy! end -- cgit v1.2.1 From c9856e53ea05374dcab0a591bd0352d321120b68 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Thu, 17 Aug 2017 11:36:58 +0100 Subject: Run remove_pages in a run_after_commit block --- app/models/project.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/models/project.rb b/app/models/project.rb index 5416786b4aa..89b4debcd42 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -60,7 +60,7 @@ class Project < ActiveRecord::Base end before_destroy :remove_private_deploy_keys - after_destroy :remove_pages + after_destroy -> { run_after_commit { remove_pages } } # update visibility_level of forks after_update :update_forks_visibility_level -- cgit v1.2.1