2017-10-08 00:43:42 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-27 23:55:23 +09:00
|
|
|
class ActivityPub::EmojiSerializer < ActivityPub::Serializer
|
2017-10-08 00:43:42 +09:00
|
|
|
include RoutingHelper
|
|
|
|
|
2019-07-08 19:03:45 +09:00
|
|
|
cache key: 'emoji', expires_in: 3.minutes
|
|
|
|
|
2019-03-27 23:55:23 +09:00
|
|
|
context_extensions :emoji
|
|
|
|
|
2017-10-08 00:43:42 +09: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
|