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
Errors and notices missing when nesting collections #2592
Comments
This should also look at addressing messages getting eaten when adding users/groups on the sharing tab. They were recently converted to AJAX processing and no longer display messages. Related Work: PR #2832 |
I've tracked this down to a collision in behavior with blacklight: projectblacklight/blacklight@4d9290f. The problem that blacklight is solving with this flash.discard isn't a problem in hyrax since turbolinks will override xhr post behavior on the rails and client side to force it to auto follow redirects, which will properly consume flash messages (see https://github.com/turbolinks/turbolinks-rails/blob/master/lib/turbolinks/redirection.rb#L13). I'm looking into proposing a change to make this behavior configurable in blacklight, since I suspect this will likely become a frequent issue for it with the recent "turbolinks by default" integration in rails. |
- Added a way to configure blacklight's discard flash behavior and changed the catalog controller template to disable this behavior by default. For applications that don't use turbolinks, they will likely want to remove this config line to restore blacklight's solution to the UX problems mentioned in projectblacklight/blacklight@4d9290f - Changed NestCollectionsController to inherit from Hyrax::My::CollectionsController. Without this, this controller would not run through the catalog controller's configure_blacklight step and would not get the override for the discard flash behavior
- Added a way to configure blacklight's discard flash behavior and changed the catalog controller template to disable this behavior by default. For applications that don't use turbolinks, they will likely want to remove this config line to restore blacklight's solution to the UX problems mentioned in projectblacklight/blacklight@4d9290f - Changed NestCollectionsController to inherit from Hyrax::My::CollectionsController. Without this, this controller would not run through the catalog controller's configure_blacklight step and would not get the override for the discard flash behavior - Now that the NestCollectionsController inherits from Hyrax::My::CollectionsController, it will redirect to login page if the user is not logged in. Fixed the spec to login as a user before performing any actions.
- install_generator now adds a skip_after_action to override Blacklight's discard_flash_if_xhr behavior at the ApplicationController level.
Descriptive summary
When nesting collections, the notices and errors do not display when adding or removing a parent collection, or adding or removing a subcollection. The notices are filled correctly and passed with the redirect, but are apparently eaten by Turbolinks. (Notices work appropriately for adding a subcollection as a new collection.)
The response after submitModalAjax is:
Turbolinks needs to be deactivated somehow, to allow the responses to use the controller redirect_to.
Rationale
It is important to have a confirmation of what is happening, particularly in the case where a collection cannot be nested because it would exceed the specified nesting depth. In this situation, nothing happens but there is no message to explain why. At least in the case of a successful nesting, you can see the nested collection on the new view.
Expected behavior
Actual behavior
/app/controllers/hyrax/dashboard/nest_collections_controller.rb
, the appropriate notices and errors are loaded as expected.(since the query service was expanded to do appropriate validation, it would be very unlikely that you would be able to produce the other flash errors via the UI without forcing an error in method
valid_combined_nesting_depth?
in/app/services/hyrax/collections/nested_collection_query_service.rb
)Steps to reproduce the behavior
add to collection
, choose a collection, and submit.add a subcollection
, choose a collection, and submit."nesting_collection__deepest_nested_depth_isi":5
)Create new collection as subcollection
.The text was updated successfully, but these errors were encountered: