app/services/hyrax/thumbnail_path_service.rb in hyrax-3.0.0.pre.rc2 vs app/services/hyrax/thumbnail_path_service.rb in hyrax-3.0.0.pre.rc3
- old
+ new
@@ -9,19 +9,24 @@
thumb = fetch_thumbnail(object)
return unless thumb
return call(thumb) unless thumb.file_set?
- if thumb.audio?
+ if audio?(thumb)
audio_image
elsif thumbnail?(thumb)
thumbnail_path(thumb)
else
default_image
end
end
private
+
+ def audio?(thumb)
+ service = thumb.respond_to?(:audio?) ? thumb : Hyrax::FileSetTypeService.new(file_set: thumb)
+ service.audio?
+ end
def fetch_thumbnail(object)
return object if object.thumbnail_id == object.id
Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: object.thumbnail_id)
rescue Hyrax::ObjectNotFoundError