diff --git a/app/controllers/concerns/hyrax/works_controller_behavior.rb b/app/controllers/concerns/hyrax/works_controller_behavior.rb index 3c6f0b035..2be8b7872 100644 --- a/app/controllers/concerns/hyrax/works_controller_behavior.rb +++ b/app/controllers/concerns/hyrax/works_controller_behavior.rb @@ -169,7 +169,7 @@ def collections_service end def admin_set_id_for_new - Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s + AdminSet.first.id.to_s end def build_form diff --git a/lib/wings/attribute_transformer_decorator.rb b/lib/wings/attribute_transformer_decorator.rb deleted file mode 100644 index f857cbb3f..000000000 --- a/lib/wings/attribute_transformer_decorator.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -module Wings - # OVERRIDE Hyrax v3.6.0 to backport a bug fix from v5.0.1. - # This override is no longer needed when Hyrax's version is >= v5.0.1 - # - # Work forms were throwing 504 time out errors because large AdminSets - # being queried by Hyrax#query_service were loading all of their members. - # - # @see https://github.com/samvera/hyrax/commit/75312ee - module AttributeTransformerDecorator - # OVERRIDE: Replace contents of this method with the version found in v5.0.1 - def run(obj) - attrs = obj.reflections.each_with_object({}) do |(key, reflection), mem| - case reflection - when ActiveFedora::Reflection::HasManyReflection, - ActiveFedora::Reflection::HasAndBelongsToManyReflection, - ActiveFedora::Reflection::IndirectlyContainsReflection - mem[:"#{key.to_s.singularize}_ids"] = - obj.association(key).ids_reader - when ActiveFedora::Reflection::DirectlyContainsReflection - mem[:"#{key.to_s.singularize}_ids"] = - Array(obj.public_send(reflection.name)).map(&:id) - when ActiveFedora::Reflection::FilterReflection, - ActiveFedora::Reflection::OrdersReflection, - ActiveFedora::Reflection::HasSubresourceReflection, - ActiveFedora::Reflection::BelongsToReflection, - ActiveFedora::Reflection::BasicContainsReflection - :noop - when ActiveFedora::Reflection::DirectlyContainsOneReflection - mem[:"#{key.to_s.singularize}_id"] = - obj.public_send(reflection.name)&.id - else - mem[reflection.foreign_key.to_sym] = - obj.public_send(reflection.foreign_key.to_sym) - end - end - - obj.class.delegated_attributes.keys.each_with_object(attrs) do |attr_name, mem| - next unless obj.respond_to?(attr_name) && !mem.key?(attr_name.to_sym) - mem[attr_name.to_sym] = TransformerValueMapper.for(obj.public_send(attr_name)).result - end - end - end -end - -Wings::AttributeTransformer.singleton_class.send(:prepend, Wings::AttributeTransformerDecorator) diff --git a/lib/wings/model_transformer_decorator.rb b/lib/wings/model_transformer_decorator.rb deleted file mode 100644 index f9d57669e..000000000 --- a/lib/wings/model_transformer_decorator.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module Wings - # OVERRIDE Hyrax v3.6.0 to backport a bug fix from v5.0.1. - # This override is no longer needed when Hyrax's version is >= v5.0.1 - # - # Work forms were throwing 504 time out errors because large AdminSets - # being queried by Hyrax#query_service were loading all of their members. - # - # @see https://github.com/samvera/hyrax/commit/75312ee - module ModelTransformerDecorator - # OVERRIDE: Remove :member_ids - def additional_attributes - { :id => pcdm_object.id, - :created_at => pcdm_object.try(:create_date), - :updated_at => pcdm_object.try(:modified_date), - ::Valkyrie::Persistence::Attributes::OPTIMISTIC_LOCK => lock_token } - end - end -end - -Wings::ModelTransformer.prepend(Wings::ModelTransformerDecorator) diff --git a/spec/requests/work_depositor_role_spec.rb b/spec/requests/work_depositor_role_spec.rb index b95ae1c2e..b53dc8cce 100644 --- a/spec/requests/work_depositor_role_spec.rb +++ b/spec/requests/work_depositor_role_spec.rb @@ -73,6 +73,7 @@ end it 'can see the work form' do + allow(AdminSet).to receive(:first).and_return(OpenStruct.new(id: 'admin_set/default')) get new_hyrax_generic_work_path expect(response).to have_http_status(:success)