logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: 3c189642561f27925803448059e212718e4a2497
parent: c61dd918a24761b7a96cb9e65e6943238f630715
Author: Yamagishi Kazutoshi <ykzts@desire.sh>
Date:   Thu,  4 Jan 2018 23:36:55 +0900

Fallback default thumbnail in instance status API (#6177)


Diffstat:

Mapp/helpers/routing_helper.rb5+++++
Mapp/serializers/rest/instance_serializer.rb2+-
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/helpers/routing_helper.rb b/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? diff --git a/app/serializers/rest/instance_serializer.rb b/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