Skip to content

Commit

Permalink
🧹 Correct transactions names and set condition
Browse files Browse the repository at this point in the history
This commit will fix names since it changed somewhere along the way. The
set child flag was being called when IIIF Print was not being used which
resulted in an error.  This commit will set the condition to only call
if the HYKU_IIIF_PRINT env var is true.
  • Loading branch information
kirkkwang committed Feb 2, 2024
1 parent 7037a9b commit 377c96d
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,29 @@ class IiifPrintContainerDecorator
end
end

namespace 'change_set' do |ops|
ops.register 'update_work' do
steps = Hyrax::Transactions::WorkUpdate::DEFAULT_STEPS.dup
steps.insert(steps.index('work_resource.update_work_members') + 1, 'work_resource.set_child_flag')
Hyrax::Transactions::WorkUpdate.new(steps: steps)
end
end

if defined?(Bulkrax::Container)
namespace 'work_resource' do |ops|
ops.register Bulkrax::Container::UPDATE_WITH_BULK_BEHAVIOR do
steps = Bulkrax::Container::UPDATE_WITH_BULK_BEHAVIOR_STEPS.dup
if ENV['HYKU_IIIF_PRINT']
namespace 'change_set' do |ops|
ops.register 'update_work' do
steps = Hyrax::Transactions::WorkUpdate::DEFAULT_STEPS.dup
steps.insert(steps.index('work_resource.update_work_members') + 1, 'work_resource.set_child_flag')
Hyrax::Transactions::WorkUpdate.new(steps: steps)
end
end
end

namespace 'work_resource' do |ops|
ops.register 'set_child_flag' do
Steps::SetChildFlag.new
if defined?(Bulkrax::Transactions::Container)
namespace 'work_resource' do |ops|
ops.register Bulkrax::Transactions::Container::UPDATE_WITH_BULK_BEHAVIOR do
steps = Bulkrax::Transactions::Container::UPDATE_WITH_BULK_BEHAVIOR_STEPS.dup
steps.insert(steps.index('work_resource.update_work_members') + 1, 'work_resource.set_child_flag')
Hyrax::Transactions::WorkUpdate.new(steps: steps)
end
end
end

namespace 'work_resource' do |ops|
ops.register 'set_child_flag' do
Steps::SetChildFlag.new
end
end
end
end
Expand Down

0 comments on commit 377c96d

Please sign in to comment.