Repository navigation
feat: start polls from the API - #662
Merged
Merged
Conversation
A new commit or a quote from the app can carry a poll, with the web's rules for its options and duration. A reply can't, as on the web.
simonhamp
marked this pull request as ready for review
October 19, 2026 23:50
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 start a poll with a new commit or a quote, as the web's composer does. 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/commitsnow takes an optionalpoll:{"body": "Tabs or spaces?", "poll": {"options": ["Tabs", "Spaces"], "duration": 1440}}The rules are the web's own, from
CreateCommitRequest::attachmentRules(): 2 to 4 options of up to 50 characters, no two the same ignoring case, and adurationin minutes, one of60,1440,4320or10080. A reply can't have a poll, sopollnext toparent_idis a422, as on the web. The poll goes through the web'sCreateCommit, so option labels get their emoji shortcodes replaced.The
201has the commit with itspoll. The poll opens when the commit is approved, so a pending commit's poll has nocloses_atyet, and an admin's opens right away.Testing
Everything CI runs passes on this branch locally: Pint, Rector, the JS lint, PHPStan, tsc, type coverage, and all 3,256 tests at 100% coverage.
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.