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

Delete and redo file sets #964

Merged
merged 4 commits into from
Jun 21, 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
20 changes: 19 additions & 1 deletion app/jobs/bulkrax/delete_file_set_job.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# frozen_string_literal: true

module Bulkrax
class DeleteFileSetJob < DeleteJob; end
class DeleteFileSetJob < DeleteJob
def perform(entry, importer_run)
file_set = entry.factory.find
if file_set
parent = file_set.parent
if parent&.respond_to?(:ordered_members)
om = parent.ordered_members.to_a
om.delete(file_set)
parent.ordered_members = om
elsif parent.respond_to?(:member_ids)
parent.member_ids.delete(file_set.id)
Hyrax.persister.save(resource: parent)
end
parent.save
end

super
end
end
end
Loading