Skip to content
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

override hyrax admin_set issue #6171 #1111

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions config/initializers/spot_overrides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,23 @@ def add_sorting_to_solr(solr_parameters)
solr_parameters[:sort] ||= (sort || "title_sort_si asc")
end
end

# Override to fix Hyrax bug where calling Hyrax::AdminSetCreateService.find_or_create_default_admin_set
# will try to load an AdminSet's entire set of members when called.
#
# @see https://github.com/samvera/hyrax/issues/6171
# @see https://github.com/WGBH-MLA/ams/commit/8983c933d7ffaf587ef9dbded74845eaae41ebea
module Spot
module AdminSetCreateServiceDecorator
private

def find_default_admin_set
AdminSet.find('admin_set/default')
rescue ActiveFedora::ObjectNotFoundError
nil
end
end
end

Hyrax::AdminSetCreateService.singleton_class.send(:prepend, Spot::AdminSetCreateServiceDecorator)
end