You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#205: restrict "Submit Review" options to what the user may actually do (#342)
* Fix#205: restrict "Submit Review" options to what the user may actually do
Users who are neither the change request author nor the article owner
(nor anyone with write access) were offered all four review options.
"Approve" silently failed and "Close" returned a 500 because there is no
"close" review type server-side.
Random users now only get the "Comment" option: "Approve", "Request
changes" and "Close" are no longer rendered for them, in the same spirit
as #192, and the server rejects such submissions with a 403 carrying an
error message instead of failing silently or with a 500.
Behaviour for the article owner / users with write access and for the
change request author (greyed-out approve/reject, per #192) is unchanged.
Co-authored-by: Pierre Schweiger <schweiger.pierre@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Fix#205: address review feedback on the Submit Review permission check
- derive the permission decision from `form.ReviewType()` instead of the raw
form strings, so renaming a form value can no longer silently fail open;
only "close", which has no `ReviewType` of its own, still matches the raw
value
- replace the package-local `jsonForbidden` helper with a
`(*context.Context).JSONForbidden` sibling of `JSONError`/`JSONErrorNotFound`
- answer an unknown review type with a 400 `JSONError` instead of a 500
- template: rename `$showSelfTooltip` to `$isChangeRequestAuthor` now that it
is also a permission input, and merge the duplicated approve/reject guard
- tests: use the exported `HTMLDoc.Find` helper and assert the `disabled`
attribute the author's approve/reject options are supposed to carry
Co-authored-by: Pierre Schweiger <schweiger.pierre@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Fix#205: satisfy perfsprint on the unknown-review-type error
The JSONError added while addressing review feedback used fmt.Sprintf with a
single trailing %s, which perfsprint rejects in favour of concatenation. This
was failing lint-backend, lint-go-gogit and lint-go-windows on PR #342; the
tests themselves were green.
Co-authored-by: Pierre Schweiger <schweiger.pierre@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments