# frozen_string_literal: true
class ActivityPub::VoteSerializer < ActivityPub::Serializer
class NoteSerializer < ActivityPub::Serializer
attributes :id, :type, :name, :attributed_to,
:in_reply_to, :to
def id
ActivityPub::TagManager.instance.uri_for(object) || [ActivityPub::TagManager.instance.uri_for(object.account), '#votes/', object.id].join
end
def type
'Note'
def name
object.poll.options[object.choice.to_i]
def attributed_to
ActivityPub::TagManager.instance.uri_for(object.account)
def in_reply_to
ActivityPub::TagManager.instance.uri_for(object.poll.status)
def to
ActivityPub::TagManager.instance.uri_for(object.poll.account)
attributes :id, :type, :actor, :to
has_one :object, serializer: ActivityPub::VoteSerializer::NoteSerializer
[ActivityPub::TagManager.instance.uri_for(object.account), '#votes/', object.id, '/activity'].join
'Create'
def actor