Skip to content

Commit

Permalink
add publisher to MemberCleanupListener
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkkwang authored and tamsin woo committed Feb 7, 2024
1 parent 89b3205 commit b32bdc5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/services/hyrax/listeners/member_cleanup_listener.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ def on_object_deleted(event)
return unless event[:object]

object = event[:object]
user = event[:user]
return unless object.is_a?(Hyrax::Work)

Hyrax.query_service.find_parents(resource: object).each do |parent|
parent.member_ids -= [object.id]
Hyrax.persister.save(resource: parent)
Hyrax.index_adapter.save(resource: parent)
Hyrax.publisher.publish('object.membership.updated', object: parent, user: user)
end
end

Expand Down

0 comments on commit b32bdc5

Please sign in to comment.