Sha256: b40bcc743f6804ebec1c21b89ed1fb6c01dbcb00139ad8ae85d4de92ce4b7a5f

Contents?: true

Size: 854 Bytes

Versions: 3

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

# override Hyrax to remove splitting upon work delete
module IiifPrint
  module Actors
    # Responsible for removing FileSets related to the given curation concern.
    module CleanupFileSetsActorDecorator
      # @param [Hyrax::Actors::Environment] env
      # @return [Boolean] true if destroy was successful
      def destroy(env)
        file_sets = env.curation_concern.file_sets
        file_sets.each do |file_set|
          # we destroy the children before the file_set, because we need the parent relationship
          IiifPrint::SplitPdfs::DestroyPdfChildWorksService.conditionally_destroy_spawned_children_of(
            file_set: file_set,
            work: env.curation_concern
          )
        end
        # and now back to your regularly scheduled programming
        super
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
iiif_print-2.0.1 app/actors/iiif_print/actors/cleanup_file_sets_actor_decorator.rb
iiif_print-2.0.0 app/actors/iiif_print/actors/cleanup_file_sets_actor_decorator.rb
iiif_print-1.1.0 app/actors/iiif_print/actors/cleanup_file_sets_actor_decorator.rb