app/presenters/hyrax/file_set_presenter.rb in hyrax-3.0.0.pre.rc2 vs app/presenters/hyrax/file_set_presenter.rb in hyrax-3.0.0.pre.rc3
- old
+ new
@@ -81,10 +81,12 @@
def fixity_check_status
Hyrax::FixityStatusPresenter.new(id).render_file_set_status
end
+ ##
+ # @return [WorkShowPresenter, nil] +nil+ if no parent can be found
def parent
@parent_presenter ||= fetch_parent_presenter
end
def user_can_perform_any_action?
@@ -98,9 +100,10 @@
end
def fetch_parent_presenter
ids = Hyrax::SolrService.query("{!field f=member_ids_ssim}#{id}", fl: Hyrax.config.id_field)
.map { |x| x.fetch(Hyrax.config.id_field) }
+ Hyrax.logger.warn("Couldn't find a parent work for FileSet: #{id}.") if ids.empty?
Hyrax::PresenterFactory.build_for(ids: ids,
presenter_class: WorkShowPresenter,
presenter_args: current_ability).first
end
end