Skip to content

Commit

Permalink
Merge pull request #6341 from samvera/valk-embargos-leases-specs
Browse files Browse the repository at this point in the history
Fix lease/embargo controller and specs in koppie
  • Loading branch information
abelemlih authored Oct 6, 2023
2 parents 94e3b4e + 43bb146 commit bf3c903
Show file tree
Hide file tree
Showing 6 changed files with 474 additions and 214 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ def update
filter_docs_with_edit_access!
copy_visibility = []
copy_visibility = params[:embargoes].values.map { |h| h[:copy_visibility] } if params[:embargoes]
resources = Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: Hyrax.config.use_valkyrie?)

resources = if Hyrax.config.use_valkyrie?
Hyrax.query_service.find_many_by_ids(ids: batch)
else
Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: false)
end

resources.each do |resource|
if Hyrax.config.use_valkyrie?
EmbargoManager.new(resource: resource).release!
Expand Down
8 changes: 7 additions & 1 deletion app/controllers/concerns/hyrax/leases_controller_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ def update
filter_docs_with_edit_access!
copy_visibility = []
copy_visibility = params[:leases].values.map { |h| h[:copy_visibility] } if params[:leases]
resources = Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: Hyrax.config.use_valkyrie?)

resources = if Hyrax.config.use_valkyrie?
Hyrax.query_service.find_many_by_ids(ids: batch)
else
Hyrax.custom_queries.find_many_by_alternate_ids(alternate_ids: batch, use_valkyrie: false)
end

resources.each do |resource|
if Hyrax.config.use_valkyrie?
LeaseManager.new(resource: resource).release!
Expand Down
Loading

0 comments on commit bf3c903

Please sign in to comment.