Repository navigation
feat: vote on polls from the API - #663
Merged
Merged
Conversation
simonhamp
marked this pull request as ready for review
October 19, 2026 23:50
Answers with the commit as its page shows it, so the app gets the poll's results once the vote is in. Votes are final and authors can't vote, as on the web.
simonhamp
force-pushed
the
feat/api-poll-votes
branch
from
October 21, 2026 00:54
85a7237 to
3f74eb3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets the mobile app vote on a poll, as the web's Vote button does. So far the app could only show polls. It follows #130 and is one of a few small PRs for the endpoints the app (NativePHP/dev-null-app) uses on top of it.
Endpoint
POST /api/v1/commits/{id}/poll/votestakes theoptionid and answers200with the commit as its page shows it, so the app gets the poll with its results straight away.It uses the web's
CreateCommitPollVoteandOpenPoll, so the rules are the web's:422onoption: "You have already voted on this poll."422that says so.422.A commit the user may not see (pending, rejected, deleted or across a block) is a
404, like starring one. The web answers403there, but the API hides what the user can't see.Testing
Everything CI runs passes on this branch locally: Pint, Rector, the JS lint, PHPStan, tsc, type coverage, and all 3,623 tests at 100% coverage. KNOWLEDGE_BASE.md lists voting among what a signed request can do.
The app side is NativePHP/dev-null-app#24. It ran against all four of these PRs merged together on an iOS simulator: photos from the library with a description, a poll, the preview, a reply with a photo, and a vote.