Skip to content

Commit

Permalink
Fallback default thumbnail in instance status API (mastodon#6177)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykzts authored and Gargron committed Jan 4, 2018
1 parent 9ba4277 commit dfe0abe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/helpers/routing_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,6 +18,10 @@ def full_asset_url(source, **options)
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?
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/rest/instance_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def version
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
Expand Down

0 comments on commit dfe0abe

Please sign in to comment.