-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Delete spawned child works as a work is deleted
This plugs into the cleanup file sets process, to add additional cleanup of child works which were created as part of a IiifPrint PDF split. Other child works are not affected.
- Loading branch information
LaRita Robinson
committed
Nov 14, 2023
1 parent
a23582d
commit ddbeab5
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
app/actors/iiif_print/actors/cleanup_file_sets_actor_decorator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters