Repository navigation
Club: let a member edit their report, and send one already decided back for review - #412
Conversation
…ck for review
Asked for in the OpenIPC chat: change a report while no maintainer has
looked at it, and have one changed after review accepted again.
- /club has Edit beside each of the member's reports: the note, the camera
they proposed (maker, marking, SoC), files taken out, photos and text
added. ipctool's output and a backup are what the camera said and stay
as sent. POST /api/v1/club/reports/{id}/edit, the member's own only.
- While it waits for review an edit is simply made. Once a maintainer has
published or rejected it, saving says so first, then adds a review row
'edit' (migration 031): the report is pending again, off the board and
the public pages, and back in the queue marked as edited. The next
decision settles its stars as any does: a file taken out is taken back,
one added is paid.
- Reports stay changed only through internal/reports: Store.Edit stands
the guard down for its own transaction as Takedown does, and every edit
is logged in append-only report_edits. A file's position is never used
twice, so the ledger's rows keep meaning what they meant. One edit and
one review never interleave (the report's lock).
- List read any decision but publish and reject as withdrawn; it reads
'edit' as pending now.
PR Summary by QodoLet members edit reports and resubmit decided reports for review
AI Description
Diagram
High-Level Assessment
Files changed (23)
|
Code Review by Qodo
1.
|
… racing a review or a takedown - The queue carries each report's revision (its sender's edit count), and a decision sent with it is refused with 409 when the report changed since: a maintainer never publishes what they did not see. - Decide reads what each file would earn under the report's lock, the one an edit holds, so a review never pays for the files as they were. - Takedown takes the same lock: an edit cannot write into a report being withdrawn, and re-checks withdrawn under it. - Changing the proposed camera unlinks the board the old one was published on; the next review decides the board afresh. - A backup stays as sent: an edit cannot take it out, and the form does not offer it. - An edit that fails after placing its files takes them back out of the store. - The edit form clears its file picker when the kind changes, so what it shows is what it sends.
Requested in the OpenIPC chat: let a member edit a report while no maintainer has reviewed it, and require a new acceptance when one already reviewed is changed.
What a member can do
On
/club, an Edit link sits beside each of their reports (not withdrawn ones). They can change:ipctool's output and a backup are what the camera said and stay as sent.
The endpoint is
POST /api/v1/club/reports/{id}/edit. It works only on the member's own reports; anyone else gets 404.A report about a new camera has to keep at least one photo. The limit of 24 files still applies, and an edit that changes nothing is refused.
Review
edit, so the report is pending again:How it's built
internal/reports.Store.Editstands the guard down for its own transaction, asTakedowndoes, and every edit is logged in the append-only, guardedreport_editstable (migration 031). The migration also addseditto the allowedreport_reviews.decisionvalues.Listread every decision other than publish and reject as "withdrawn". It now readseditas pending.Tests
club/edit_test.go, all in one test:EditReport.test.tsx: only what changed is sent, and the re-review warning appears.service/run.sh test: all 23 packages pass, and gofmt is clean. Frontend lint, typecheck, tests (709) and build pass, and the bundle check passes.Not yet done