Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[semver-major] rename object.file.updated to file.updated #6167

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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