From fa93156528bca4306e040a1b73720b6411942fcf Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 23 Jun 2017 17:02:33 -0700 Subject: Defer project destroys within a namespace in Groups::DestroyService#async_execute Group#destroy would actually hard-delete all associated projects even though the acts_as_paranoia gem is used, preventing Projects::DestroyService from doing any work. We first noticed this while trying to log all projects deletion to the Geo log. --- app/models/namespace.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/models/namespace.rb') diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 743e0513e02..672eab94c07 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -219,6 +219,12 @@ class Namespace < ActiveRecord::Base parent.present? end + def soft_delete_without_removing_associations + # We can't use paranoia's `#destroy` since this will hard-delete projects. + # Project uses `pending_delete` instead of the acts_as_paranoia gem. + self.deleted_at = Time.now + end + private def repository_storage_paths -- cgit v1.2.1