♻️ Favor existing method call over custom #6705
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is technically a change in functionality, but one that moves
towards consistent method usage.
Prior to this commit, we were saying
can_create_any_work?
andreferencing the
Hyrax.config.curation_concerns
. Other places in thecode instead reference
curation_concerns_models
.The difference is that
curation_concerns_models
includes FileSets andCollections. Further, the odds that the user cannot create a Pcdm::Work
but could create a Collection or FileSet are low; meaning that this
simplification helps reduce logic foibles.
Also, as we look to Hyku, we are approaching curation concern
registration differently. The original model (e.g.
GenericWork
andImage
) are registered and we indicate the Valkyrie::Resources asmigrations of those model types. Meaning that
Hyrax.config.curation_concerns
only hasGenericWork
but we wantthese permissions to apply to the migrations as well.
If we don't approve this change, I'll revise Hyku's approach.
Below is a quick list of the app usages of the method:
Using
rg can_create_any_work app
`app/views/hyrax/my/works/index.html.erb`
This logic indicates if they can see the create a new work type or not.
`
Do we show the user analytics information? Again the information should
only be of things they can create. So we aren't over-exposing any
information.
`app/presenters/hyrax/homepage_presenter.rb`
Below is the impact
This will either show or not show a work for sharing. They would still
need to be able to read the work to see the button.