Skip to content

Commit

Permalink
[semver-major] rename object.file.updated to file.updated
Browse files Browse the repository at this point in the history
addresses #6161
  • Loading branch information
dunn committed Aug 22, 2023
1 parent 9d06f2b commit 1307919
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/services/hyrax/listeners/file_metadata_listener.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/services/hyrax/valkyrie_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions lib/hyrax/publisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/services/hyrax/valkyrie_upload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

Expand Down

0 comments on commit 1307919

Please sign in to comment.