Commit 989fbac
feat: PostW5 Wave B2 — share-reports moderation queue
Closes audit v2 §05 ("Reports queue"). Migration 0027 landed earlier
in 52c454e; this commit ships the consumer surface end-to-end.
Backend
- New `share_reports` module: ShareReport/ShareReportStatus/
ShareReportReason + ShareReportStore trait + Postgres impl +
MemoryShareReportStore for tests.
- `POST /v1/share/report` in sharing_routes: reporter (auth'd user)
must be one of {owner, recipient}; rate-limited at 5 reports per
reporter per 24h; emits `share.reported` audit row.
- `GET /v1/admin/sharing/reports?status=` and
`POST /v1/admin/sharing/reports/:id/resolve` in admin_sharing_routes:
moderator-gated (admins inherit); resolve emits
`share.report_resolved` audit row; 409 on double-resolve.
- main.rs wires `Arc<dyn ShareReportStore>` extension.
- openapi.rs registers 3 paths + 5 schemas.
- 8 new store tests (status/reason round-trips, is_resolution,
create+get, list+filter+order, double-resolve rejection, not_found,
case-insensitive rate-limit count). Suite 289 → 297 passing.
Frontend
- `apps/web/src/app/sharing/actions.ts` — `reportShareAction`
server action.
- `/sharing` (inbound list): per-share collapsed `<details>` with a
reason picker + optional details textarea + Submit button. Form
posts to the new action; recipient_handle is threaded from
`session.claimedHandle` (server-side, not trusted from client).
- `/admin/sharing/reports` (NEW): moderator queue page with status
filter strip (open/dismissed/share_revoked/user_suspended/all),
per-row form with three resolution buttons (Dismiss / Revoke /
Suspend owner), optional moderator note (≤ 500 chars). Server
action revalidates the path on each transition; 409 races refresh
silently rather than throwing.
- `/admin/sharing` overview grows a "Reports queue →" link in the
existing sub-nav strip.
- api.ts client functions: `reportShare`, `getAdminSharingReports`,
`resolveShareReport` + 5 schema type aliases.
- schema.ts regenerated.
All gates green: cargo check, cargo test (297/297), cargo clippy
-D warnings, cargo fmt --check, pnpm typecheck, pnpm lint
(only pre-existing warnings).1 parent e0b4f7f commit 989fbac
13 files changed
Lines changed: 2097 additions & 42 deletions
File tree
- apps/web/src
- app
- admin/sharing
- reports
- sharing
- lib
- crates/starstats-server/src
- bin
- packages/api-client-ts/src/generated
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
374 | 381 | | |
375 | 382 | | |
376 | 383 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
0 commit comments