Skip to content

feat: report commits from the API - #552

Merged
xHeaven merged 4 commits into
dev-null-sh:productionfrom
simonhamp:feat/api-report
Oct 19, 2026
Merged

xHeaven merged 4 commits into
dev-null-sh:productionfrom
simonhamp:feat/api-report

Conversation

@simonhamp

Copy link
Copy Markdown
Contributor

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": "..."}. details is optional, up to 500 characters.

  • 204 when the report is made. Reporting the same commit again also answers 204 and keeps the first report.
  • 403 with the new code own_commit for the user's own commit.
  • 404 with the new code commit_unavailable for a commit that is pending, rejected, deleted, missing, or across a block. They all get the same answer, as on the web.
  • 422 for a bad reason or details.
  • 429 with rate_limited over 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 same commit_unavailable as one the user can't see, rather than a plain 404. 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.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 06:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@simonhamp
simonhamp marked this pull request as ready for review October 19, 2026 08:47
Copilot AI balanced review requested due to automatic review settings October 19, 2026 14:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 15:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@xHeaven
xHeaven merged commit 49c4ed0 into dev-null-sh:production Oct 19, 2026
4 of 5 checks passed
@simonhamp
simonhamp deleted the feat/api-report branch October 19, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants