Skip to content

Commit

Permalink
allow valkyrie to power collection member removal from Dashboard (#4972)
Browse files Browse the repository at this point in the history
  • Loading branch information
straleyb authored May 26, 2021
1 parent 69d3ee3 commit b87e771
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/controllers/hyrax/dashboard/collections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,15 @@ def add_members_to_collection(collection = nil)

def remove_members_from_collection
batch.each do |pid|
work = Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: pid, use_valkyrie: false)
work.member_of_collections.delete @collection
work.save!
work = Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: pid, use_valkyrie: Hyrax.config.use_valkyrie?)
case work
when ActiveFedora::Base
work.member_of_collections.delete @collection
work.save!
when Valkyrie::Resource
work.member_of_collection_ids.delete @collection.id
Hyrax.persister.save(resource: work)
end
end
end

Expand Down

0 comments on commit b87e771

Please sign in to comment.