Skip to content

Commit

Permalink
Remove proxy deposit listener, use transfer request actor
Browse files Browse the repository at this point in the history
Essentially reverts #4653.

The listener appears to be failing to run correctly due to race
conditions observed when investigating #5457 and a similar bug that
appeared after an upgrade to hyrax 3.2 at Duke.

The actor is un-deprecated here because the
full actor stack will be deprecated once it's been replaced by the
valkyrie transactions code path.

Advances #5457; addition of a transaction step in a forthcoming PR.
  • Loading branch information
hackartisan committed Mar 14, 2022
1 parent 2df0b27 commit e82bed0
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 101 deletions.
5 changes: 0 additions & 5 deletions app/actors/hyrax/actors/transfer_request_actor.rb
@@ -1,17 +1,12 @@
# frozen_string_literal: true
module Hyrax
module Actors
##
# @deprecated transfer requests are now carried out in response to published
# 'object.deposited' events.
#
# Notify the provided owner that their proxy wants to make a
# deposit on their behalf
class TransferRequestActor < AbstractActor
# @param [Hyrax::Actors::Environment] env
# @return [Boolean] true if create was successful
def create(env)
Deprecation.warn('Use Hyrax::Listeners::ProxyDepositListener instead.')
next_actor.create(env) && create_proxy_deposit_request(env)
end

Expand Down
3 changes: 3 additions & 0 deletions app/services/hyrax/default_middleware_stack.rb
Expand Up @@ -42,6 +42,9 @@ def self.build_stack
# Decode the private/public/institution on the form into permisisons on
# the model
middleware.use Hyrax::Actors::InterpretVisibilityActor
#
# Handles transfering ownership of works from one user to another
middleware.use Hyrax::Actors::TransferRequestActor

# Copies default permissions from the PermissionTemplate to the work
middleware.use Hyrax::Actors::ApplyPermissionTemplateActor
Expand Down
1 change: 0 additions & 1 deletion app/services/hyrax/listeners.rb
Expand Up @@ -25,7 +25,6 @@ module Listeners
autoload :MemberCleanupListener
autoload :MetadataIndexListener
autoload :ObjectLifecycleListener
autoload :ProxyDepositListener
autoload :TrophyCleanupListener
autoload :WorkflowListener
end
Expand Down
22 changes: 0 additions & 22 deletions app/services/hyrax/listeners/proxy_deposit_listener.rb

This file was deleted.

1 change: 0 additions & 1 deletion config/initializers/listeners.rb
Expand Up @@ -9,7 +9,6 @@
Hyrax.publisher.subscribe(Hyrax::Listeners::MemberCleanupListener.new)
Hyrax.publisher.subscribe(Hyrax::Listeners::MetadataIndexListener.new)
Hyrax.publisher.subscribe(Hyrax::Listeners::ObjectLifecycleListener.new)
Hyrax.publisher.subscribe(Hyrax::Listeners::ProxyDepositListener.new)
Hyrax.publisher.subscribe(Hyrax::Listeners::TrophyCleanupListener.new)
Hyrax.publisher.subscribe(Hyrax::Listeners::WorkflowListener.new)

Expand Down
10 changes: 0 additions & 10 deletions spec/controllers/concerns/hyrax/works_controller_behavior_spec.rb
Expand Up @@ -95,16 +95,6 @@
expect(Sipity::Entity(assigns[:curation_concern]).workflow_state).to have_attributes(name: "deposited")
end

context 'when depositing as a proxy for (on_behalf_of) another user' do
let(:create_params) { { title: 'comet in moominland', on_behalf_of: target_user.user_key } }
let(:target_user) { FactoryBot.create(:user) }

it 'transfers depositor status to proxy target' do
expect { post :create, params: { test_simple_work: create_params } }
.to have_enqueued_job(ContentDepositorChangeEventJob)
end
end

context 'when setting visibility' do
let(:create_params) { { title: 'comet in moominland', visibility: 'open' } }

Expand Down
14 changes: 0 additions & 14 deletions spec/features/actor_stack_spec.rb
Expand Up @@ -142,20 +142,6 @@ def create(env)
end
end
end

describe 'when doing a proxy deposit' do
let(:target_user) { FactoryBot.create(:user) }
let(:attributes) do
{ title: ['comet in moominland'],
on_behalf_of: target_user.user_key }
end

it 'enqueues exactly one ContentDepositorChangeEventJob' do
expect { actor.create(env) }
.to have_enqueued_job(ContentDepositorChangeEventJob)
.exactly(:once)
end
end
end

describe '#update' do
Expand Down
1 change: 1 addition & 0 deletions spec/services/hyrax/default_middleware_stack_spec.rb
Expand Up @@ -17,6 +17,7 @@
Hyrax::Actors::ApplyOrderActor,
Hyrax::Actors::DefaultAdminSetActor,
Hyrax::Actors::InterpretVisibilityActor,
Hyrax::Actors::TransferRequestActor,
Hyrax::Actors::ApplyPermissionTemplateActor,
Hyrax::Actors::CleanupFileSetsActor,
Hyrax::Actors::CleanupTrophiesActor,
Expand Down
48 changes: 0 additions & 48 deletions spec/services/hyrax/listeners/proxy_deposit_listener_spec.rb

This file was deleted.

0 comments on commit e82bed0

Please sign in to comment.