app/actors/hyrax/actors/base_actor.rb in hyrax-4.0.0 vs app/actors/hyrax/actors/base_actor.rb in hyrax-5.0.0.rc1
- old
+ new
@@ -69,11 +69,12 @@
end
def save(env, use_valkyrie: false)
return env.curation_concern.save unless use_valkyrie
- resource = valkyrie_save(resource: env.curation_concern.valkyrie_resource)
+ # don't run validations again on the converted object if they've already passed
+ resource = valkyrie_save(resource: env.curation_concern.valkyrie_resource, is_valid: env.curation_concern.save)
# we need to manually set the id and reload, because the actor stack requires
# `env.curation_concern` to be the exact same instance throughout.
# casting back to ActiveFedora doesn't satisfy this.
env.curation_concern.id = resource.alternate_ids.first.id unless env.curation_concern.id
@@ -113,12 +114,12 @@
# Return the hash of attributes that are multivalued and not uploaded files
def multivalued_form_attributes(attributes)
attributes.select { |_, v| v.respond_to?(:select) && !v.respond_to?(:read) }
end
- def valkyrie_save(resource:)
+ def valkyrie_save(resource:, is_valid:)
permissions = resource.permission_manager.acl.permissions
- resource = Hyrax.persister.save(resource: resource)
+ resource = Hyrax.persister.save(resource: resource, perform_af_validation: !is_valid)
resource.permission_manager.acl.permissions = permissions
resource.permission_manager.acl.save
resource
end