Skip to content

Commit

Permalink
🎁 Switch transaction to listener
Browse files Browse the repository at this point in the history
This commit will switch the membership transaction to a listener.
  • Loading branch information
kirkkwang authored and jeremyf committed Feb 6, 2024
1 parent 6a81ac1 commit c8f87ad
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions app/jobs/bulkrax/create_relationships_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c8f87ad

Please sign in to comment.