Sha256: adc98029e9649a57e0d09ac55452a7e57963ef905fa385c8e5bef72757d52bc2
Contents?: true
Size: 937 Bytes
Versions: 48
Compression:
Stored size: 937 Bytes
Contents
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
48 entries across 48 versions & 1 rubygems