diff --git a/app/services/hyrax/listeners/file_metadata_listener.rb b/app/services/hyrax/listeners/file_metadata_listener.rb index ed6c3c44f1..6ef1538faa 100644 --- a/app/services/hyrax/listeners/file_metadata_listener.rb +++ b/app/services/hyrax/listeners/file_metadata_listener.rb @@ -35,10 +35,10 @@ def on_file_metadata_updated(event) end ## - # Called when 'object.file.uploaded' event is published + # Called when 'file.uploaded' event is published # @param [Dry::Events::Event] event # @return [void] - def on_object_file_uploaded(event) + def on_file_uploaded(event) # Run characterization Hyrax.config .characterization_service diff --git a/app/services/hyrax/valkyrie_upload.rb b/app/services/hyrax/valkyrie_upload.rb index f0c11738cb..7c7131efc2 100644 --- a/app/services/hyrax/valkyrie_upload.rb +++ b/app/services/hyrax/valkyrie_upload.rb @@ -52,7 +52,7 @@ def upload(filename:, file_set:, io:, use: Hyrax::FileMetadata::Use::ORIGINAL_FI saved_metadata = Hyrax.persister.save(resource: file_metadata) saved_metadata.original_filename = filename if saved_metadata.original_filename.blank? - Hyrax.publisher.publish("object.file.uploaded", metadata: saved_metadata) + Hyrax.publisher.publish("file.uploaded", metadata: saved_metadata) add_file_to_file_set(file_set: file_set, file_metadata: saved_metadata, diff --git a/lib/hyrax/publisher.rb b/lib/hyrax/publisher.rb index db8b0ec6a9..d7386128a1 100644 --- a/lib/hyrax/publisher.rb +++ b/lib/hyrax/publisher.rb @@ -137,6 +137,10 @@ class Publisher # a system user. register_event('file.metadata.updated') + # @since 5.0.0 + # @macro a_registered_event + register_event('file.uploaded') + # @since 3.0.0 # @macro a_registered_event register_event('file.set.audited') @@ -191,10 +195,6 @@ class Publisher # `#member_ids`) register_event('object.metadata.updated') - # @since 3.2.0 - # @macro a_registered_event - register_event('object.file.uploaded') - ## # @return Array[Object] the listeners Hyrax subscribes by default. def default_listeners diff --git a/spec/services/hyrax/valkyrie_upload_spec.rb b/spec/services/hyrax/valkyrie_upload_spec.rb index 5f27e0581f..9d73fb7433 100644 --- a/spec/services/hyrax/valkyrie_upload_spec.rb +++ b/spec/services/hyrax/valkyrie_upload_spec.rb @@ -58,7 +58,7 @@ io: upload.uploader.file.to_file, user: upload.user ) - expect(listener.object_file_uploaded.map(&:payload)) + expect(listener.file_uploaded.map(&:payload)) .to contain_exactly(match(metadata: have_attributes(id: an_instance_of(Valkyrie::ID), original_filename: upload.file.filename)))