瀏覽代碼

Fallback default thumbnail in instance status API (#6177)

master
Yamagishi Kazutoshi 6 年之前
committed by Eugen Rochko
父節點
當前提交
3c18964256
共有 2 個檔案被更改,包括 6 行新增1 行删除
  1. +5
    -0
      app/helpers/routing_helper.rb
  2. +1
    -1
      app/serializers/rest/instance_serializer.rb

+ 5
- 0
app/helpers/routing_helper.rb 查看文件

@@ -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?


+ 1
- 1
app/serializers/rest/instance_serializer.rb 查看文件

@@ -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…
取消
儲存