Repository navigation
feat: report commits from the API - #552
Merged
Merged
Conversation
simonhamp
marked this pull request as ready for review
October 19, 2026 08:47
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 report a commit to the moderators, the way the web's Report button does. It follows #130, which added the signed API, 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}/reports, signed, with{"reason": "spam" | "harassment" | "unsafe" | "other", "details": "..."}.detailsis optional, up to 500 characters.204when the report is made. Reporting the same commit again also answers204and keeps the first report.403with the new codeown_commitfor the user's own commit.404with the new codecommit_unavailablefor a commit that is pending, rejected, deleted, missing, or across a block. They all get the same answer, as on the web.422for a badreasonordetails.429withrate_limitedover the web's limit of 5 reports a minute.Reporting doesn't hide the commit.
Worth checking
The route uses
->missing()so a commit that doesn't exist gets the samecommit_unavailableas one the user can't see, rather than a plain404. The app needs the code to show the right message.Testing
Everything CI runs passes on this branch locally: Pint, Rector, the JS lint, PHPStan, tsc, type coverage, and all 2,979 tests at 100% coverage.
The app's Report option in a commit's More menu (NativePHP/dev-null-app#7) has been checked against it.