2017-10-07 18:43:42 +03:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-27 16:55:23 +02:00
|
|
|
class ActivityPub::EmojiSerializer < ActivityPub::Serializer
|
2017-10-07 18:43:42 +03:00
|
|
|
include RoutingHelper
|
|
|
|
|
2019-03-27 16:55:23 +02:00
|
|
|
context_extensions :emoji
|
|
|
|
|
2017-10-07 18:43:42 +03:00
|
|
|
attributes :id, :type, :name, :updated
|
|
|
|
|
|
|
|
has_one :icon, serializer: ActivityPub::ImageSerializer
|
|
|
|
|
|
|
|
def id
|
|
|
|
ActivityPub::TagManager.instance.uri_for(object)
|
|
|
|
end
|
|
|
|
|
|
|
|
def type
|
|
|
|
'Emoji'
|
|
|
|
end
|
|
|
|
|
|
|
|
def icon
|
|
|
|
object.image
|
|
|
|
end
|
|
|
|
|
|
|
|
def updated
|
|
|
|
object.updated_at.iso8601
|
|
|
|
end
|
|
|
|
|
|
|
|
def name
|
|
|
|
":#{object.shortcode}:"
|
|
|
|
end
|
|
|
|
end
|