Merge commit '4aea3f88a6d30f102a79c2da7fcfac96465ba1a8' into merging-upstream
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class REST::InstanceSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
attributes :uri, :title, :description, :email,
|
||||
:version, :urls, :stats
|
||||
:version, :urls, :stats, :thumbnail
|
||||
|
||||
def uri
|
||||
Rails.configuration.x.local_domain
|
||||
@@ -24,6 +26,10 @@ class REST::InstanceSerializer < ActiveModel::Serializer
|
||||
Mastodon::Version.to_s
|
||||
end
|
||||
|
||||
def thumbnail
|
||||
full_asset_url(instance_presenter.thumbnail.file.url) if instance_presenter.thumbnail
|
||||
end
|
||||
|
||||
def stats
|
||||
{
|
||||
user_count: instance_presenter.user_count,
|
||||
|
@@ -7,11 +7,19 @@ class REST::MediaAttachmentSerializer < ActiveModel::Serializer
|
||||
:remote_url, :text_url, :meta
|
||||
|
||||
def url
|
||||
full_asset_url(object.file.url(:original))
|
||||
if object.needs_redownload?
|
||||
media_proxy_url(object.id, :original)
|
||||
else
|
||||
full_asset_url(object.file.url(:original))
|
||||
end
|
||||
end
|
||||
|
||||
def preview_url
|
||||
full_asset_url(object.file.url(:small))
|
||||
if object.needs_redownload?
|
||||
media_proxy_url(object.id, :small)
|
||||
else
|
||||
full_asset_url(object.file.url(:small))
|
||||
end
|
||||
end
|
||||
|
||||
def text_url
|
||||
|
@@ -17,6 +17,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
||||
has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
|
||||
has_many :mentions
|
||||
has_many :tags
|
||||
has_many :emojis
|
||||
|
||||
def current_user?
|
||||
!current_user.nil?
|
||||
@@ -106,4 +107,14 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
||||
tag_url(object)
|
||||
end
|
||||
end
|
||||
|
||||
class CustomEmojiSerializer < ActiveModel::Serializer
|
||||
include RoutingHelper
|
||||
|
||||
attributes :shortcode, :url
|
||||
|
||||
def url
|
||||
full_asset_url(object.image.url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user