Skip to content

Add method to VersioningService to detect support #6239

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

Merged
merged 1 commit into from
Aug 29, 2023

Conversation

marrus-sh
Copy link
Collaborator

Right now Hyrax::VersioningService does some silent coersion of versioning information in the case that versioning is not supported by the storage adapter. But, it might be good to actively provide a different UI to users in some cases depending on whether multiple versions of a file can actually be stored.

This commit adds a supports_multiple_versions? method to Hyrax::VersioningService which returns true iff the resource is non‐nil and not a FileMetadata object, or if it is a FileMetadata object and the storage adapter supports versioning.

This check requires having both a resource and a storage adapter in‐hand. My guess is that this is reasonable, but if we need to detect versioning support more generally (without a specific resource), a different solution may be desirable (altho
Hyrax.storage_adapter.try?(:"supports?", :versions) works in this case.)


Related to #6211 in the sense of being a prerequisite for disabling this functionality in the UI in cases where it will definitely not work.

@marrus-sh marrus-sh added notes-minor Release Notes: Non-breaking features notes-valkyrie Release Notes: Valkyrie specific labels Aug 29, 2023
Right now `Hyrax::VersioningService` does some silent coersion of
versioning information in the case that versioning is not supported by
the storage adapter. But, it might be good to actively provide a
different UI to users in some cases depending on whether multiple
versions of a file can actually be stored.

This commit adds a `supports_multiple_versions?` method to
`Hyrax::VersioningService` which returns `true` iff the `resource` is
non‐nil and not a `FileMetadata` object, or if it is a `FileMetadata`
object and the storage adapter supports versioning.

This check requires having both a resource and a storage adapter in‐hand.
My guess is that this is reasonable, but if we need to detect versioning
support more generally (without a specific resource), a different
solution may be desirable (altho
`Hyrax.storage_adapter.try?(:"supports?", :versions)` works in this
case.)
@marrus-sh marrus-sh force-pushed the query_versioning_support branch from 581e3a2 to eefe2a0 Compare August 29, 2023 00:07
@no-reply no-reply merged commit dd9baaf into main Aug 29, 2023
@no-reply no-reply deleted the query_versioning_support branch August 29, 2023 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes-minor Release Notes: Non-breaking features notes-valkyrie Release Notes: Valkyrie specific
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants