Sha256: 2d2eaf5ee326d1d17b64216f008533a011639b26935fc89cd9cf7790abb78563
Contents?: true
Size: 953 Bytes
Versions: 25
Compression:
Stored size: 953 Bytes
Contents
# frozen_string_literal: true module Hyrax module Actors # Removes featured works if the work is deleted or becomes private class FeaturedWorkActor < Hyrax::Actors::AbstractActor # @param [Hyrax::Actors::Environment] env # @return [Boolean] true if destroy was successful def destroy(env) cleanup_featured_works(env.curation_concern) next_actor.destroy(env) end # @param [Hyrax::Actors::Environment] env # @return [Boolean] true if update was successful def update(env) check_featureability(env.curation_concern) next_actor.update(env) end private def cleanup_featured_works(curation_concern) FeaturedWork.where(work_id: curation_concern.id).destroy_all end def check_featureability(curation_concern) return unless curation_concern.private? cleanup_featured_works(curation_concern) end end end end
Version data entries
25 entries across 25 versions & 1 rubygems