Admin review moderation
Administrators review all member reading reflections (reviews) in one list and can hide or restore any entry to control the quality of content shown to other users. The action is enforced server-side: only users with the ADMIN role may change a review's hidden state, and the request must reference a real review with a valid hidden flag.
Document details · v1
Waiting for your review. Until you approve it, AI agents do not treat it as fact and it stays out of your Live Docs.
User flow
3admin
Open the moderation screen to see all submitted reviews
ResultThe screen lists every review with its book, author, date, visibility and hidden status; if there are none, an empty-state message is shown instead
Starts when · Signed-in user has the ADMIN role
Interaction details
- all · navigate
admin
Hide an inappropriate review from general view
ResultThe review card's button shows the hide action and, once clicked, is disabled while the request is in flight
Starts when · A review in the list is currently not hidden
Interaction details
- all · click
admin
Restore a previously hidden review
ResultThe button label switches to the restore action for hidden reviews; clicking it sends the same moderation request with hidden set to false, unhiding the review on success
Starts when · A review in the list is currently hidden
Interaction details
- all · click
Business rules
4Policies and constraints the product must keep.
- 01PermissionBR-ADMIN-MODERATION-01
Only a user whose role is ADMIN may hide or restore a review; any other role receives a FORBIDDEN error with status 403.
Rule scope and code anchor
Roles · ROLE-ADMIN
Read linked criteria here
- AC-ADMIN-MODERATION-01When an authenticated ADMIN sends a moderation request with a valid reviewId and a boolean hidden value, the system updates the review's hidden flag and returns { ok: true, status: 200 }.
- AC-ADMIN-MODERATION-02When the acting user's role is not ADMIN, the moderation request fails with { ok: false, status: 403, error: 'FORBIDDEN' } and no review is changed.
- 02ValidationBR-ADMIN-MODERATION-02
The moderation request body must be a plain object containing a boolean 'hidden' field; otherwise a VALIDATION error with status 400 is returned.
Read linked criteria here
- AC-ADMIN-MODERATION-01When an authenticated ADMIN sends a moderation request with a valid reviewId and a boolean hidden value, the system updates the review's hidden flag and returns { ok: true, status: 200 }.
- AC-ADMIN-MODERATION-03When the request body is missing the 'hidden' field or it is not a boolean, the system returns { ok: false, status: 400, error: 'VALIDATION' }.
- 03ValidationBR-ADMIN-MODERATION-03
The reviewId in the request must match an existing review; if none is found, a NOT_FOUND error with status 404 is returned.
Read linked criteria here
- AC-ADMIN-MODERATION-01When an authenticated ADMIN sends a moderation request with a valid reviewId and a boolean hidden value, the system updates the review's hidden flag and returns { ok: true, status: 200 }.
- AC-ADMIN-MODERATION-04When the reviewId does not match any existing review, the system returns { ok: false, status: 404, error: 'NOT_FOUND' }.
- 04RestrictionBR-ADMIN-MODERATION-04
The request must carry a valid, unexpired session token resolving to a known user; otherwise an UNAUTHENTICATED error with status 401 is returned.
Linked criteria 1Criterion 05Read linked criteria here
- AC-ADMIN-MODERATION-05When the request has no valid, unexpired session, the system returns { ok: false, status: 401, error: 'UNAUTHENTICATED' } and the review remains unchanged.
Acceptance criteria
6Expected outcomes. These entries do not claim a test was run or passed.
- 01CriterionAC-ADMIN-MODERATION-01
When an authenticated ADMIN sends a moderation request with a valid reviewId and a boolean hidden value, the system updates the review's hidden flag and returns { ok: true, status: 200 }.
- 02CriterionAC-ADMIN-MODERATION-02
When the acting user's role is not ADMIN, the moderation request fails with { ok: false, status: 403, error: 'FORBIDDEN' } and no review is changed.
Linked rules 1Rule 01 - 03CriterionAC-ADMIN-MODERATION-03
When the request body is missing the 'hidden' field or it is not a boolean, the system returns { ok: false, status: 400, error: 'VALIDATION' }.
Linked rules 1Rule 02 - 04CriterionAC-ADMIN-MODERATION-04
When the reviewId does not match any existing review, the system returns { ok: false, status: 404, error: 'NOT_FOUND' }.
Linked rules 1Rule 03 - 05CriterionAC-ADMIN-MODERATION-05
When the request has no valid, unexpired session, the system returns { ok: false, status: 401, error: 'UNAUTHENTICATED' } and the review remains unchanged.
Linked rules 1Rule 04 - 06CriterionAC-ADMIN-MODERATION-06
The moderation list view displays every review regardless of hidden status, labeling hidden ones, and shows an empty-state message when no reviews exist.
Linked rules 0
Source files 21
- page.tsx
- LeafProvider.tsx
- useLeafState.ts
- useLeafLocale.ts
- locale.ts
- layout.tsx
- headings.tsx
- store.mjs
- initial-state.mjs
- password.mjs
- action-support.ts
- domain-error.mjs
- session.mjs
- validation.mjs
- types.ts
- FeatureFrame.tsx
- moderation.tsx
- reviews.tsx
- actions.ts
- moderation.mjs
- actionView.ts
Source anchors are injected deterministically. No GitHub repository is connected. File links are unavailable.
