Votes on Question activities

When a Question activity is posted and you select one of the options, what then happens in terms of the protocol? What is the expected ActivityPub representation of a vote on a Question?

1 Like

Mastodon does the following checks on Create Note to identify poll votes: mastodon/create.rb at cff7d967f97b5119f9cf68f84973a8e36ec9d7c6 · mastodon/mastodon · GitHub

return false if

replied_to_status.nil?
|| replied_to_status.preloadable_poll.nil?
|| !replied_to_status.local?
|| !replied_to_status.preloadable_poll.options.include?(@object['name'])

So the requirements are like so, according to Mastodon:

  • Create Note
  • inReplyTo exists
  • inReplyTo is a status that is a poll
  • inReplyTo is local
  • inReplyTo‚Äôs poll includes an option equivalent to name

Here is how Mastodon serializes votes: mastodon/vote_serializer.rb at cff7d967f97b5119f9cf68f84973a8e36ec9d7c6 · mastodon/mastodon · GitHub

id: ...
type: Note
name: <the exact text of the poll option>
inreplyTo: <some status that is a poll>
attributedTo: <you>
to: <the poll maker>

Tangentially, here is Mastodon’s poll parser: mastodon/poll_parser.rb at cff7d967f97b5119f9cf68f84973a8e36ec9d7c6 · mastodon/mastodon · GitHub

Note that Mastodon does not use Question as an activity, but rather, as an object. So Mastodon will send out and expect Create Question.

2 Likes

If it’s addressed to the poll maker then does this make it similar to them receiving a DM?

it should be like a DM, yes

1 Like