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