Skip to content

Initial poll implementation#2113

Draft
BentiGorlich wants to merge 3 commits into
mainfrom
new/polls
Draft

Initial poll implementation#2113
BentiGorlich wants to merge 3 commits into
mainfrom
new/polls

Conversation

@BentiGorlich
Copy link
Copy Markdown
Member

  • add the ability to add a poll to Entry, EntryComment, Post and PostComment
  • Polls:
    • can be multiple choice
    • can contain an unlimited number of choices
    • can expire
  • Add a hidden form for the poll to all create forms, the form appears when a checkbox is checked
  • The ActivityPub implementation is the same as on Mastodon: https://docs.joinmastodon.org/spec/activitypub/#Question
  • Add tests for the ActivityPub implementation and the Api controller
  • The api had to be shifted a bit -> the serialize... functions in the base api take only the entity classes now instead of their dto variant -> touched a lot of api classes because of this

I will add images when this moves out of the draft phase :)

Closes #647

@BentiGorlich BentiGorlich self-assigned this Apr 23, 2026
@BentiGorlich BentiGorlich added enhancement New feature or request frontend Visual issues, improvements, bugs or other aspects relating mostly to the front end activitypub ActivityPub related issues backend Backend related issues and pull requests api API related issues and pull requests labels Apr 23, 2026
@BentiGorlich
Copy link
Copy Markdown
Member Author

Open things:

  • This does not yet send an Update activity upon a new vote, which I though Mastodon also doesn't do, but there is an fep for this that was also mentioned in the issue and it says that an implementation should do it: https://codeberg.org/silverpill/feps/src/branch/main/9967/fep-9967.md
  • it does not yet use the closed property, which it should do if endTime is not provided
  • the Poll AP object does not yet have an updated field.
  • All in all some AP stuff has to be done
  • one cannot yet manually refresh the results
  • one cannot yet jump to the results without voting

- add the ability to add a poll to Entry, EntryComment, Post and PostComment
- Polls:
  - can be multiple choice
  - can contain an unlimited number of choices
  - can expire
- Add a hidden form for the poll to all create forms, the form appears when a checkbox is checked
- The ActivityPub implementation is the same as on Mastodon: https://docs.joinmastodon.org/spec/activitypub/#Question
- Add tests for the ActivityPub implementation and the Api controller
- The api had to be shifted a bit -> the `serialize...` functions in the base api take only the entity classes now instead of their dto variant -> touched a lot of api classes because of this
- fix the end date being ignored upon poll creation
- make the poll end date DATETIMETZ_IMMUTABLE -> with time zone
- implement refreshing the vote counts of remote polls
- fix handling of `Update` activities -> only edit the poll (and discarding all votes) when the content actually changed, pass through the correct object to refresh the poll counts
- send an `Update` activity when a vote is created on a local poll
- fix missing query from `EntryCommentRepository` and `PostCommentRepository` in the `PollVoteFactory`
- add a way to invalidate the cache of an activity object
- add support for the `closed` property on polls (it is the same as `endTime`)
- add a way to just show the results of a poll in the UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

activitypub ActivityPub related issues api API related issues and pull requests backend Backend related issues and pull requests enhancement New feature or request frontend Visual issues, improvements, bugs or other aspects relating mostly to the front end

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement polls like they have at mastodon

1 participant