Class: Hyrax::Listeners::ProxyDepositListener

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/listeners/proxy_deposit_listener.rb

Overview

Listens for deposit events, and checks for proxy situations. When a user deposits an item `on_behalf_of` another, ensures transfer is handled.

Instance Method Summary collapse

Instance Method Details

#on_object_deposited(event) ⇒ Object

Parameters:

  • event (Dry::Event)

11
12
13
14
15
16
17
# File 'app/services/hyrax/listeners/proxy_deposit_listener.rb', line 11

def on_object_deposited(event)
  return if event[:object].try(:on_behalf_of).blank? ||
            (event[:object].on_behalf_of == event[:object].depositor)

  ContentDepositorChangeEventJob
    .perform_later(event[:object], ::User.find_by_user_key(event[:object].on_behalf_of))
end