Skip to content

Commit

Permalink
🐛 remove passing user to work_resource add_file_sets and save merge t…
Browse files Browse the repository at this point in the history
…o strategies
  • Loading branch information
ShanaLMoore committed Mar 14, 2024
1 parent 8ea0388 commit 5f9be5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions app/factories/bulkrax/valkyrie_object_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def create_work(object:, attrs:)
transactions["work_resource.create_with_bulk_behavior"]
.with_step_args(
"work_resource.add_to_parent" => { parent_id: attrs[related_parents_parsed_mapping], user: @user },
'work_resource.add_file_sets' => { uploaded_files: get_files(attrs), user: @user },
'work_resource.add_file_sets' => { uploaded_files: get_files(attrs) },
"change_set.set_user_as_depositor" => { user: @user },
"work_resource.change_depositor" => { user: @user },
'work_resource.save_acl' => { permissions_params: [attrs['visibility'] || 'open'].compact }
Expand Down Expand Up @@ -169,7 +169,7 @@ def update_work(object:, attrs:)
perform_transaction_for(object: object, attrs: attrs) do
transactions["work_resource.update_with_bulk_behavior"]
.with_step_args(
'work_resource.add_file_sets' => { uploaded_files: get_files(attrs), user: @user },
'work_resource.add_file_sets' => { uploaded_files: get_files(attrs) },
'work_resource.save_acl' => { permissions_params: [attrs.try('visibility') || 'open'].compact }
)
end
Expand Down Expand Up @@ -265,10 +265,10 @@ def new_remote_files
def conditionally_destroy_existing_files
return unless @replace_files

if klass < Valkyrie::Resource
destroy_existing_files
elsif [Bulkrax.collection_model_class, Bulkrax.file_model_class].include?(klass)
if [Bulkrax.collection_model_class, Bulkrax.file_model_class].include?(klass)
return
elsif klass < Valkyrie::Resource
destroy_existing_files
else
raise "Unexpected #{klass} for #{self.class}##{__method__}"
end
Expand Down
6 changes: 3 additions & 3 deletions lib/bulkrax/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ class Engine < ::Rails::Engine

if defined?(::Goddess::CustomQueryContainer)
strategies = ::Goddess::CustomQueryContainer.known_custom_queries_and_their_strategies
strategies.merge(custom_query_strategies)
strategies = strategies.merge(custom_query_strategies)
::Goddess::CustomQueryContainer.known_custom_queries_and_their_strategies = strategies
end

if defined?(::Frigg::CustomQueryContainer)
strategies = ::Frigg::CustomQueryContainer.known_custom_queries_and_their_strategies
strategies.merge(custom_query_strategies)
strategies = strategies.merge(custom_query_strategies)
::Frigg::CustomQueryContainer.known_custom_queries_and_their_strategies = strategies
end

if defined?(::Freyja::CustomQueryContainer)
strategies = ::Freyja::CustomQueryContainer.known_custom_queries_and_their_strategies
strategies.merge(custom_query_strategies)
strategies = strategies.merge(custom_query_strategies)
::Freyja::CustomQueryContainer.known_custom_queries_and_their_strategies = strategies
end
end
Expand Down

0 comments on commit 5f9be5a

Please sign in to comment.