Fix link to user's works on dashboard #6373
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.
Fixes
Fixes #6359
Summary
When Valkyrie is used, the generic type in Solr is stored in field
generic_type_si
, instead ofgeneric_type_sim
for apps that are not using Valkyrie. This causes the application to generate the wrong link to a user's works on the dashboard.Guidance for testing, such as acceptance criteria or new user interface behaviors:
Type of change (for release notes)
notes-bugfix
Bug FixesDetailed Description
To generate the link to a user's works on the dashboard, the application previously added facet params for two fields:
depositor_ssim
andgeneric_type_sim
. The application relied on the methodsearch_state_with_facets
, which is a generic method from theHyraxHelperBehavior
that generates the facet params to be used in the link. This method is no longer useful for this particular case, since it assumes all facet fields are multivalued, whilegeneric_type_si
is not for Valkyrie apps.In this PR, I avoided adding custom logic for this method, and added a new method in the
DashboardHelperBehavior
instead. The new method I added,#link_to_works
, generates the correct link for a user's works whether Valkyrie is used or not.Changes proposed in this pull request:
link_to_field
from theHyraxHelperBehavior
to link to a user's works#link_to_works
, to theDashboardHelperBehavior
that checks whether Valkyrie is used and generates the correct link. For Valyrie applications, the method usesgeneric_type_si
for the facet params, andgeneric_type_sim
for the other use cases.spec/helpers/hyrax/dashboard_helper_behavior_spec.rb
to verify that the new method generates the correct link for both uses cases@samvera/hyrax-code-reviewers