Sha256: b25a1b9a3fcef3660fe60792ef90c5ee754b5bbc8d89e33a747bc8d008b722de
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
require 'newspaper_works/data/fileset_helper' require 'newspaper_works/data/path_helper' require 'newspaper_works/data/work_derivatives' require 'newspaper_works/data/work_files' require 'newspaper_works/data/work_file' module NewspaperWorks # Module for data access helper / adapter classes supporting, enhancing # NewspaperWorks work models module Data # Handler for after_create_fileset, to be called by block subscribing to # and overriding default Hyrax `:after_create_fileset` handler, via # app integrating newspaper_works. def self.handle_after_create_fileset(file_set, user) handle_queued_derivative_attachments(file_set) # Hyrax queues this job by default, and since newspaper_works # overrides the single subscriber Hyrax uses to do so, we # must call this here: FileSetAttachedEventJob.perform_later(file_set, user) work = file_set.member_of[0] # Hyrax CreateWithRemoteFilesActor has glaring omission re: this job, # so we call it here, once we have a fileset to copy permissions to. InheritPermissionsJob.perform_later(work) unless work.nil? end def self.handle_queued_derivative_attachments(file_set) return if file_set.import_url.nil? work = file_set.member_of.select(&:work?)[0] derivatives = NewspaperWorks::Data::WorkDerivatives.of(work) # For now, becuase this is IO-bound operation, it makes sense to have # this not be a job, but run inline: derivatives.commit_queued!(file_set) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
newspaper_works-1.0.1 | lib/newspaper_works/data.rb |
newspaper_works-1.0.0 | lib/newspaper_works/data.rb |
newspaper_works-0.1.0 | lib/newspaper_works/data.rb |