Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate WorkShowPresenter#member_presenters_for #4902

Merged
merged 2 commits into from
May 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/presenters/hyrax/work_show_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def representative_presenter
return nil if representative_id.blank?
@representative_presenter ||=
begin
result = member_presenters_for([representative_id]).first
result = member_presenters([representative_id]).first
return nil if result.try(:id) == id
result.try(:representative_presenter) || result
end
Expand Down Expand Up @@ -181,9 +181,13 @@ def list_of_item_ids_to_display
paginated_item_list(page_array: authorized_item_ids)
end

##
# @deprecated use `#member_presenters(ids)` instead
#
# @param [Array<String>] ids a list of ids to build presenters for
# @return [Array<presenter_class>] 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

Expand Down
13 changes: 0 additions & 13 deletions spec/presenters/hyrax/work_show_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,19 +239,6 @@
end
end

describe "#member_presenters_for" do
let(:obj) { create(:work_with_file_and_work) }
let(:attributes) { obj.to_solr }
let(:items) { presenter.ordered_ids }
let(:subject) { presenter.member_presenters_for(items) }

it "returns appropriate classes for each item" do
expect(subject.size).to eq 2
expect(subject.first).to be_instance_of(Hyrax::FileSetPresenter)
expect(subject.last).to be_instance_of(described_class)
end
end

describe "#list_of_item_ids_to_display" do
let(:subject) { presenter.list_of_item_ids_to_display }
let(:items_list) { (0..9).map { |i| "item#{i}" } }
Expand Down