# Votes on Question activities

**URL:** <https://socialhub.activitypub.rocks/t/votes-on-question-activities/2880>\
**Category:** Welcome\
**Tags:** protocol\
**Created:** [January 10, 2023, 12:44pm UTC](https://socialhub.activitypub.rocks/t/votes-on-question-activities/2880 "2023-01-10T12:44:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bashrc](https://socialhub.activitypub.rocks/user_avatar/socialhub.activitypub.rocks/bashrc/32/2053_2.png) [@bashrc](https://socialhub.activitypub.rocks/u/bashrc)\
**Post date:** [January 10, 2023, 12:44pm UTC](https://socialhub.activitypub.rocks/t/votes-on-question-activities/2880/1 "2023-01-10T12:44:11Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![trwnh](https://socialhub.activitypub.rocks/user_avatar/socialhub.activitypub.rocks/trwnh/32/262_2.png) [@trwnh](https://socialhub.activitypub.rocks/u/trwnh)\
**Post date:** [January 11, 2023, 3:52am UTC](https://socialhub.activitypub.rocks/t/votes-on-question-activities/2880/2 "2023-01-11T03:52:00Z")

</div>

Mastodon does the following checks on Create Note to identify poll votes: [mastodon/create.rb at cff7d967f97b5119f9cf68f84973a8e36ec9d7c6 · mastodon/mastodon · GitHub](https://github.com/mastodon/mastodon/blob/cff7d967f97b5119f9cf68f84973a8e36ec9d7c6/app/lib/activitypub/activity/create.rb#L306)

```ruby
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](https://github.com/mastodon/mastodon/blob/cff7d967f97b5119f9cf68f84973a8e36ec9d7c6/app/serializers/activitypub/vote_serializer.rb)

```yaml
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](https://github.com/mastodon/mastodon/blob/cff7d967f97b5119f9cf68f84973a8e36ec9d7c6/app/lib/activitypub/parser/poll_parser.rb)

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

---

<div class="post-metadata">

**Author:** ![bashrc](https://socialhub.activitypub.rocks/user_avatar/socialhub.activitypub.rocks/bashrc/32/2053_2.png) [@bashrc](https://socialhub.activitypub.rocks/u/bashrc)\
**Post date:** [January 11, 2023, 3:11pm UTC](https://socialhub.activitypub.rocks/t/votes-on-question-activities/2880/3 "2023-01-11T15:11:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![trwnh](https://socialhub.activitypub.rocks/user_avatar/socialhub.activitypub.rocks/trwnh/32/262_2.png) [@trwnh](https://socialhub.activitypub.rocks/u/trwnh)\
**Post date:** [January 12, 2023, 3:35am UTC](https://socialhub.activitypub.rocks/t/votes-on-question-activities/2880/4 "2023-01-12T03:35:11Z")

</div>

it should be like a DM, yes
