From abd5955f325b966ebd21d0de8d96b61cf0421cf3 Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Fri, 15 Nov 2024 14:50:49 -0500 Subject: [PATCH] Send string ids into job (#6975) * Send string ids into job Serialize was failing on valkyrie ids * Fix work factory to not automatically index --- lib/freyja/persister.rb | 2 +- lib/hyrax/specs/shared_specs/factories/hyrax_work.rb | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/freyja/persister.rb b/lib/freyja/persister.rb index a4122e7ac2..c03219cdbe 100644 --- a/lib/freyja/persister.rb +++ b/lib/freyja/persister.rb @@ -34,7 +34,7 @@ def convert_and_migrate_resource(orm_object) new_resource = resource_factory.to_resource(object: orm_object) if Hyrax.config.valkyrie_transition? MigrateFilesToValkyrieJob.perform_later(new_resource) if new_resource.is_a?(Hyrax::FileSet) && new_resource.file_ids.size == 1 && new_resource.file_ids.first.id.to_s.match('/files/') - MigrateResourcesJob.perform_later(ids: new_resource.member_ids) if new_resource.is_a?(Hyrax::Work) + MigrateResourcesJob.perform_later(ids: new_resource.member_ids.map(&:to_s)) if new_resource.is_a?(Hyrax::Work) end new_resource end diff --git a/lib/hyrax/specs/shared_specs/factories/hyrax_work.rb b/lib/hyrax/specs/shared_specs/factories/hyrax_work.rb index 4c8308277d..87b8832dda 100644 --- a/lib/hyrax/specs/shared_specs/factories/hyrax_work.rb +++ b/lib/hyrax/specs/shared_specs/factories/hyrax_work.rb @@ -107,7 +107,14 @@ Hyrax::EmbargoManager.new(resource: work).apply Hyrax::LeaseManager.new(resource: work).apply - work.permission_manager.acl.save + if evaluator.with_index + work.permission_manager.acl.save + else + # manually save acl change_set so it does not automatically index the work + change_set = work.permission_manager.acl.send(:change_set) + change_set.sync + Hyrax.persister.save(resource: change_set.resource) + end # This has to happen after permissions for permissions to propagate. if evaluator.uploaded_files.present?