destroying.rb revision 1a27febbf1cd38fedfa2e0c65d0684abcf66006d
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa scope :destroying, ->() { unscoped.where(is_destroying: true) }
be464317febc0e3a3dbfff2df7a31c3f4b982c88Eugen Kuksa scope :active, ->() { where(is_destroying: false) }
245dfcfa9c4ef88578b8ae0a19e0fa5462eb61c9Eugen Kuksa def self.find_deleted_repository_with_owner(path, user)
1a27febbf1cd38fedfa2e0c65d0684abcf66006dEugen Kuksa repository if user.owned_ids('Repository').include?(repository.id)
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa # Only use `destroy_asynchronously` if you want to destroy a repository.
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa # It prepares the deletion by setting a flag, which enables the deletion
bd63e05633307b60a7216b523b2b7a2bcc7b2823Eugen Kuksa Rails.logger.info("Destroy #{self.class} #{self} (id: #{id})")
28042dd9ac50a328466a3dd0464b6e26a7c8796dEugen Kuksa raise Repository::DeleteError, I18n.t('repository.delete_error')
bd63e05633307b60a7216b523b2b7a2bcc7b2823Eugen Kuksa Rails.logger.info("Mark #{self.class} #{self} (id: #{id}) as is_destroying")
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksa RepositoryDeletionWorker.perform_in(DELETION_WAIT_TIME, id)
113cd002139756abd35496a70a5aae2a8dbd4d62Eugen Kuksa self.destroy_job_at = DELETION_WAIT_TIME.from_now