From aca8c6db781173117213f80570aeb86e75d47424 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Mon, 5 Feb 2024 15:59:44 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=81=20Switch=20transaction=20to=20list?= =?UTF-8?q?ener?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit will switch the membership transaction to a listener. --- app/jobs/bulkrax/create_relationships_job.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/jobs/bulkrax/create_relationships_job.rb b/app/jobs/bulkrax/create_relationships_job.rb index d52a2349..d6bc29c1 100644 --- a/app/jobs/bulkrax/create_relationships_job.rb +++ b/app/jobs/bulkrax/create_relationships_job.rb @@ -182,16 +182,8 @@ def add_to_valkyrie_work(child_record, parent_record) return true if parent_record.member_ids.include?(child_record.id) parent_record.member_ids << child_record.id - - # TODO: Hyrax is in the process of extracting an "Action" object that we could call. It does - # provide validation that we may want to consider. - # - # NOTE: We may need to look at the step args we're passing, see - # `Hyrax::WorksControllerBehavior#update_valkyrie_work` - # Hyrax's `./app/controllers/concerns/hyrax/works_controller_behavior.rb` - # - change_set = Hyrax::ChangeSet.for(parent_record) - Hyrax::Transactions::Container['change_set.update_work'].call(change_set) + Hyrax.persister.save(resource: parent_record) + Hyrax.publisher.publish('object.membership.updated', object: parent_record) end def add_to_af_work(child_record, parent_record)