This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2022-11-28 14:23:13 -08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ActivityPub::EmojiReactionSerializer < ActivityPub::Serializer
|
|
|
|
attributes :id, :type, :actor, :content
|
|
|
|
attribute :virtual_object, key: :object
|
|
|
|
|
|
|
|
has_one :custom_emoji, key: :tag, serializer: ActivityPub::EmojiSerializer, unless: -> { object.custom_emoji.nil? }
|
|
|
|
|
|
|
|
def id
|
|
|
|
[ActivityPub::TagManager.instance.uri_for(object.account), '#emoji_reactions/', object.id].join
|
|
|
|
end
|
|
|
|
|
|
|
|
def type
|
|
|
|
'EmojiReact'
|
|
|
|
end
|
|
|
|
|
|
|
|
def actor
|
|
|
|
ActivityPub::TagManager.instance.uri_for(object.account)
|
|
|
|
end
|
|
|
|
|
|
|
|
def virtual_object
|
|
|
|
ActivityPub::TagManager.instance.uri_for(object.status)
|
|
|
|
end
|
|
|
|
|
|
|
|
def content
|
|
|
|
if object.custom_emoji.nil?
|
|
|
|
object.name
|
|
|
|
else
|
|
|
|
":#{object.name}:"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-11-29 00:15:52 -08:00
|
|
|
alias reaction content
|
2022-11-28 14:23:13 -08:00
|
|
|
end
|