samvera / hyrax

Hyrax is a Ruby on Rails Engine built by the Samvera community. Hyrax provides a foundation for creating many different digital repository applications.
http://hyrax.samvera.org/
Apache License 2.0
185 stars 124 forks source link

Hyrax::Collections::NestedCollectionQueryService logic not adequate #2221

Closed laritakr closed 6 years ago

laritakr commented 6 years ago

Descriptive summary

( Collections Sprint)

The list of available child collections and available parent collections should not include any collections currently in ANY relationship (either parent or child) with the collection being modified.

The nesting query service needs to take into account the full ancestral path. It should match the logic used in the nesting indexer.

Rationale

Adding these as a parent or child should cause a PCDM error, and does cause circular indexing errors. We need to keep them from the list of options to select.

Nesting decisions should be made in /app/services/hyrax/collections/nested_collection_query_service.rb. Additional validations (if specific to one particular case), could occur in the form /app/forms/hyrax/forms/dashboard/nest_collection_form.rb, but in general, we want the query service provide a fully valid list of collections for nesting.

Details

Given a collection, available parent collections should include only:

Given a collection, available subcollections should include only:

Solr fields for nesting collections are:

Related Issues

Pull Request: Populate edit Relationships tab #1719 Manage Collection Relationships Tab #2257 Refactor the nested collection modal queries to use the form #2294 Wire up nested collection delete buttons #2295

elrayle commented 6 years ago

A slight adjustment to the available children:

This means that assuming existing paths A-B-D and A-C, it is ok to create A-D and A-C-D.

    A
   /  \
  B    C
  |
  D

can become...

      A
   /  |  \
  B   C   D
  |   |
  D   D
elrayle commented 6 years ago
elrayle commented 6 years ago

Fixed by #2574