Skip to content

Commit

Permalink
Merge pull request #5282 from samvera/val/col_listing
Browse files Browse the repository at this point in the history
fix dashboard -> collection not showing collections created as valkyrie resources
  • Loading branch information
dlpierce authored Dec 10, 2021
2 parents d76407e + 4d57079 commit fdf78a1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CollectionsSearchBuilder < Hyrax::CollectionSearchBuilder

# This overrides the models in FilterByType
def models
[::AdminSet, ::Collection, Hyrax.config.collection_model.safe_constantize].uniq.compact
[::AdminSet, ::Collection, Hyrax.config.collection_class].uniq.compact
end

# adds a filter to exclude collections and admin sets created by the
Expand Down
2 changes: 1 addition & 1 deletion app/search_builders/hyrax/my/collections_search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ def show_only_collections_deposited_by_current_user(solr_parameters)
# This overrides the models in FilterByType
# @return [Array<Class>] a list of classes to include
def models
[::AdminSet, Hyrax::AdministrativeSet, Hyrax.config.collection_model.safe_constantize].compact
[::AdminSet, Hyrax::AdministrativeSet, ::Collection, Hyrax.config.collection_class].uniq.compact
end
end
2 changes: 1 addition & 1 deletion lib/hyrax/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ def collection_model
##
# @return [Class] the configured collection model class
def collection_class
collection_model.constantize
collection_model.safe_constantize
end

attr_writer :admin_set_model
Expand Down
8 changes: 8 additions & 0 deletions spec/search_builders/hyrax/collection_search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
is_expected
.to contain_exactly(*[::Collection, Hyrax.config.collection_class].uniq)
end

context 'when collection class is not ::Collection' do
before { allow(Hyrax.config).to receive(:collection_model).and_return('Hyrax::PcdmCollection') }
its(:models) do
is_expected
.to contain_exactly(*[::Collection, Hyrax::PcdmCollection].uniq)
end
end
end

describe '#discovery_permissions' do
Expand Down
10 changes: 10 additions & 0 deletions spec/search_builders/hyrax/my/collections_search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
Hyrax::AdministrativeSet,
Hyrax.config.collection_class)
end

context 'when collection class is something other than ::Collection' do
before { allow(Hyrax.config).to receive(:collection_model).and_return('Hyrax::PcdmCollection') }
it do
is_expected.to contain_exactly(AdminSet,
Hyrax::AdministrativeSet,
::Collection,
Hyrax::PcdmCollection)
end
end
end

describe ".default_processor_chain" do
Expand Down

0 comments on commit fdf78a1

Please sign in to comment.