2021-05-19 05:58:27 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-06-28 22:15:41 +00:00
|
|
|
class REST::EmojiReactionSerializer < ActiveModel::Serializer
|
|
|
|
include RoutingHelper
|
|
|
|
|
2021-09-17 06:20:32 +00:00
|
|
|
attributes :name
|
2021-06-28 22:15:41 +00:00
|
|
|
|
|
|
|
attribute :url, if: :custom_emoji?
|
|
|
|
attribute :static_url, if: :custom_emoji?
|
|
|
|
attribute :domain, if: :custom_emoji?
|
|
|
|
|
2021-09-17 06:20:32 +00:00
|
|
|
belongs_to :account, serializer: REST::AccountSerializer
|
2021-06-28 22:15:41 +00:00
|
|
|
|
|
|
|
def custom_emoji?
|
|
|
|
object.custom_emoji.present?
|
|
|
|
end
|
|
|
|
|
|
|
|
def url
|
|
|
|
full_asset_url(object.custom_emoji.image.url)
|
|
|
|
end
|
|
|
|
|
|
|
|
def static_url
|
|
|
|
full_asset_url(object.custom_emoji.image.url(:static))
|
|
|
|
end
|
|
|
|
|
|
|
|
def domain
|
|
|
|
object.custom_emoji.domain
|
|
|
|
end
|
2021-05-19 05:58:27 +00:00
|
|
|
end
|