Skip to content

Commit

Permalink
Merge pull request #4902 from samvera/deprecate-member_presesters_for
Browse files Browse the repository at this point in the history
deprecate `WorkShowPresenter#member_presenters_for`
  • Loading branch information
jeremyf authored May 1, 2021
2 parents efee62e + 3963182 commit f96b070
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
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

0 comments on commit f96b070

Please sign in to comment.