Fallback default thumbnail in instance status API (#6177)
This commit is contained in:
parent
c61dd918a2
commit
3c18964256
2 changed files with 6 additions and 1 deletions
|
@ -4,6 +4,7 @@ module RoutingHelper
|
|||
extend ActiveSupport::Concern
|
||||
include Rails.application.routes.url_helpers
|
||||
include ActionView::Helpers::AssetTagHelper
|
||||
include Webpacker::Helper
|
||||
|
||||
included do
|
||||
def default_url_options
|
||||
|
@ -17,6 +18,10 @@ module RoutingHelper
|
|||
URI.join(root_url, source).to_s
|
||||
end
|
||||
|
||||
def full_pack_url(source, **options)
|
||||
full_asset_url(asset_pack_path(source, options))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def use_storage?
|
||||
|
|
|
@ -27,7 +27,7 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
|||
end
|
||||
|
||||
def thumbnail
|
||||
full_asset_url(instance_presenter.thumbnail.file.url) if instance_presenter.thumbnail
|
||||
instance_presenter.thumbnail ? full_asset_url(instance_presenter.thumbnail.file.url) : full_pack_url('preview.jpg')
|
||||
end
|
||||
|
||||
def stats
|
||||
|
|
Loading…
Reference in a new issue