diff --git a/app/models/admin_set.rb b/app/models/admin_set.rb index 587bff521c..e8b6fa3064 100644 --- a/app/models/admin_set.rb +++ b/app/models/admin_set.rb @@ -42,25 +42,6 @@ class AdminSet < ActiveFedora::Base before_destroy :check_if_not_default_set, :check_if_empty after_destroy :destroy_permission_template - def self.default_set?(id) - Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \ - "Instead, use 'Hyrax::AdminSetCreateService.default_admin_set?(id:)'.") - Hyrax::AdminSetCreateService.default_admin_set?(id: id) - end - - def default_set? - Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \ - "Instead, use 'Hyrax::AdminSetCreateService.default_admin_set?(id:)'.") - self.class.default_set?(id) - end - - # Creates the default AdminSet and an associated PermissionTemplate with workflow - def self.find_or_create_default_admin_set_id - Deprecation.warn("'##{__method__}' will be removed in Hyrax 4.0. " \ - "Instead, use 'Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id'.") - Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id.to_s - end - def collection_type_gid # allow AdminSet to behave more like a regular Collection Hyrax::CollectionType.find_or_create_admin_set_type.to_global_id @@ -86,17 +67,6 @@ def active_workflow Sipity::Workflow.find_active_workflow_for(admin_set_id: id) end - ## - # @deprecated use PermissionTemplate#reset_access_controls_for instead - # - # Calculate and update who should have edit access based on who - # has "manage" access in the PermissionTemplateAccess - def reset_access_controls! - Deprecation.warn("reset_access_controls! is deprecated; use PermissionTemplate#reset_access_controls_for instead.") - - permission_template.reset_access_controls_for(collection: self) - end - # @api public # # return an id for the AdminSet. @@ -120,7 +90,7 @@ def check_if_empty end def check_if_not_default_set - return true unless default_set? + return true unless Hyrax::AdminSetCreateService.default_admin_set?(id: id) errors[:base] << I18n.t('hyrax.admin.admin_sets.delete.error_default_set') throw :abort end diff --git a/app/models/hyrax/collection_type.rb b/app/models/hyrax/collection_type.rb index 40268649ba..976aaa0be3 100644 --- a/app/models/hyrax/collection_type.rb +++ b/app/models/hyrax/collection_type.rb @@ -70,7 +70,7 @@ def self.find_by_gid(gid) # @see #gid # @see Hyrax::MultipleMembershipChecker def self.gids_that_do_not_allow_multiple_membership - where(allow_multiple_membership: false).map(&:gid) + where(allow_multiple_membership: false).map { |c| c.to_global_id.to_s } end # Find the collection type associated with the Global Identifier (gid) @@ -98,18 +98,6 @@ def self.settings_attributes SETTINGS_ATTRIBUTES end - ## - # @deprecation use #to_global_id - # - # Return the Global Identifier for this collection type. - # @return [String, nil] Global Identifier (gid) for this collection_type (e.g. gid://internal/hyrax-collectiontype/3) - # - # @see https://github.com/rails/globalid#usage - def gid - Deprecation.warn('use #to_global_id.') - to_global_id.to_s if id - end - ## # @return [Enumerable] def collections(use_valkyrie: Hyrax.config.use_valkyrie?) diff --git a/app/presenters/hyrax/presenter_renderer.rb b/app/presenters/hyrax/presenter_renderer.rb index ada71b3977..03de41fb38 100644 --- a/app/presenters/hyrax/presenter_renderer.rb +++ b/app/presenters/hyrax/presenter_renderer.rb @@ -22,13 +22,6 @@ def label(field) default: [:"defaults.#{field}", field.to_s.humanize]).presence end - ## - # @deprecated - def fields(terms, &_block) - Deprecation.warn("Fields is deprecated for removal in Hyrax 4.0.0. use #value and #label directly instead.") - @view_context.safe_join(terms.map { |term| yield self, term }) - end - private def render_show_field_partial(field_name, locals) diff --git a/app/presenters/hyrax/work_show_presenter.rb b/app/presenters/hyrax/work_show_presenter.rb index 6b2cd2bd70..8486859f10 100644 --- a/app/presenters/hyrax/work_show_presenter.rb +++ b/app/presenters/hyrax/work_show_presenter.rb @@ -190,16 +190,6 @@ def list_of_item_ids_to_display paginated_item_list(page_array: authorized_item_ids) end - ## - # @deprecated use `#member_presenters(ids)` instead - # - # @param [Array] ids a list of ids to build presenters for - # @return [Array] presenters for the array of ids (not filtered by class) - def member_presenters_for(an_array_of_ids) - Deprecation.warn("Use `#member_presenters` instead.") - member_presenters(an_array_of_ids) - end - # @return [Integer] total number of pages of viewable items def total_pages (total_items.to_f / rows_from_params.to_f).ceil diff --git a/app/views/hyrax/base/_items.html.erb b/app/views/hyrax/base/_items.html.erb index 7240c73832..82d3353255 100644 --- a/app/views/hyrax/base/_items.html.erb +++ b/app/views/hyrax/base/_items.html.erb @@ -1,6 +1,6 @@ <% array_of_ids = presenter.list_of_item_ids_to_display %> -<% members = presenter.member_presenters_for(array_of_ids) %> +<% members = presenter.member_presenters(array_of_ids) %> <% if members.present? %> diff --git a/spec/models/admin_set_spec.rb b/spec/models/admin_set_spec.rb index ce792695bd..4400e31309 100644 --- a/spec/models/admin_set_spec.rb +++ b/spec/models/admin_set_spec.rb @@ -112,55 +112,6 @@ end end - describe ".default_set?", :clean_repo do - before { FactoryBot.valkyrie_create(:default_hyrax_admin_set) } - context "with default AdminSet ID" do - it "returns true" do - expect(described_class.default_set?(described_class::DEFAULT_ID)).to be true - end - end - - context "with a non-default ID" do - it "returns false" do - expect(described_class.default_set?('different-id')).to be false - end - end - end - - describe "#default_set?", :clean_repo do - let(:default_admin_set) do - administrative_set = FactoryBot.valkyrie_create(:default_hyrax_admin_set) - Wings::ActiveFedoraConverter.new(resource: administrative_set).convert - end - context "with default AdminSet ID" do - subject { default_admin_set.default_set? } - - it { is_expected.to be_truthy } - end - - context "with a non-default ID" do - subject { described_class.new(id: 'why-would-you-name-the-default-chupacabra?').default_set? } - - it { is_expected.to be_falsey } - end - end - - describe ".find_or_create_default_admin_set_id" do - subject { described_class.find_or_create_default_admin_set_id } - - let(:default_admin_set) { build(:default_hyrax_admin_set) } - - before do - allow(Hyrax::AdminSetCreateService).to receive(:find_or_create_default_admin_set) - .and_return(default_admin_set) - end - - it 'gets the default admin set from the create service and returns the DEFAULT_ID' do - expect(Hyrax::AdminSetCreateService).to receive(:find_or_create_default_admin_set) - expect(subject).to eq(described_class::DEFAULT_ID) - end - end - describe "#destroy" do context "with member works" do before do @@ -227,40 +178,4 @@ end end end - - describe '#reset_access_controls!' do - let!(:user) { build(:user) } - let!(:admin_set) { create(:admin_set, creator: [user.user_key], edit_users: [user.user_key], edit_groups: [::Ability.admin_group_name], read_users: [], read_groups: ['public']) } - let!(:permission_template) { build(:permission_template) } - - before do - allow(admin_set).to receive(:permission_template).and_return(permission_template) - allow(permission_template).to receive(:agent_ids_for).with(access: 'manage', agent_type: 'user').and_return(['mgr1@ex.com', 'mgr2@ex.com', user.user_key]) - allow(permission_template).to receive(:agent_ids_for).with(access: 'manage', agent_type: 'group').and_return(['managers', ::Ability.admin_group_name]) - allow(permission_template).to receive(:agent_ids_for).with(access: 'deposit', agent_type: 'user').and_return(['dep1@ex.com', 'dep2@ex.com']) - allow(permission_template).to receive(:agent_ids_for).with(access: 'deposit', agent_type: 'group').and_return(['depositors', 'registered']) - allow(permission_template).to receive(:agent_ids_for).with(access: 'view', agent_type: 'user').and_return(['vw1@ex.com', 'vw2@ex.com']) - allow(permission_template).to receive(:agent_ids_for).with(access: 'view', agent_type: 'group').and_return(['viewers', 'public']) - end - - it 'resets user edit access' do - admin_set.reset_access_controls! - expect(admin_set.edit_users).to match_array([user.user_key, 'mgr1@ex.com', 'mgr2@ex.com']) - end - - it 'resets group edit access' do - admin_set.reset_access_controls! - expect(admin_set.edit_groups).to match_array(['managers', ::Ability.admin_group_name]) - end - - it 'resets user read access' do - admin_set.reset_access_controls! - expect(admin_set.read_users).to match_array(['dep1@ex.com', 'dep2@ex.com', 'vw1@ex.com', 'vw2@ex.com']) - end - - it 'resets group read access' do - admin_set.reset_access_controls! - expect(admin_set.read_groups).to match_array(['depositors', 'viewers']) - end - end end diff --git a/spec/models/hyrax/collection_type_spec.rb b/spec/models/hyrax/collection_type_spec.rb index e2995d6689..e7da043d3d 100644 --- a/spec/models/hyrax/collection_type_spec.rb +++ b/spec/models/hyrax/collection_type_spec.rb @@ -38,18 +38,6 @@ expect(collection_type).not_to assign_visibility end - describe '#gid' do - it 'returns the gid when id exists' do - collection_type.id = 5 - expect(collection_type.gid.to_s).to eq "gid://#{GlobalID.app}/#{described_class}/5" - end - - it 'returns nil when id is nil' do - collection_type.id = nil - expect(collection_type.gid).to be_nil - end - end - describe ".any_nestable?" do context "when there is a nestable collection type" do let!(:collection_type) { FactoryBot.create(:collection_type, nestable: true) } @@ -125,10 +113,6 @@ describe '.find_by_gid' do let(:collection_type) { FactoryBot.create(:collection_type) } - it 'returns the same collection type the gid exists' do - expect(described_class.find_by_gid(collection_type.gid)).to eq collection_type - end - it 'returns the same collection type with `#to_global_id`' do expect(described_class.find_by_gid(collection_type.to_global_id)).to eq collection_type end @@ -145,10 +129,6 @@ describe '.find_by_gid!' do let(:collection_type) { FactoryBot.create(:collection_type) } - it 'returns instance of collection type when one with the gid exists' do - expect(described_class.find_by_gid(collection_type.gid)).to eq collection_type - end - it 'returns the same collection type with `#to_global_id`' do expect(described_class.find_by_gid!(collection_type.to_global_id)).to eq collection_type end diff --git a/spec/views/hyrax/base/_items.html.erb_spec.rb b/spec/views/hyrax/base/_items.html.erb_spec.rb index 30a7826789..b11bf3302f 100644 --- a/spec/views/hyrax/base/_items.html.erb_spec.rb +++ b/spec/views/hyrax/base/_items.html.erb_spec.rb @@ -6,7 +6,7 @@ context 'when children are not present' do let(:member_list) { [] } - let(:presenter) { double(:presenter, list_of_items_to_display: member_list, member_presenters_for: member_list, id: 'the-id', human_readable_type: 'Thing') } + let(:presenter) { double(:presenter, list_of_items_to_display: member_list, member_presenters: member_list, id: 'the-id', human_readable_type: 'Thing') } before do expect(presenter).to receive(:list_of_item_ids_to_display).and_return(member_list) @@ -40,7 +40,7 @@ stub_template 'hyrax/base/_member.html.erb' => '<%= member %>' expect(Flipflop).to receive(:hide_private_items?).and_return(:flipflop) allow(presenter).to receive(:list_of_item_ids_to_display).and_return(member_list) - allow(presenter).to receive(:member_presenters_for).with(member_list).and_return(member_list) + allow(presenter).to receive(:member_presenters).with(member_list).and_return(member_list) allow(presenter).to receive(:ordered_ids).and_return([]) allow(ability).to receive(:can?).with(:read, child1.id).and_return true