Skip to content

Add admin tools to /food: empty lists and comments (#236) - #237

Merged
NinjaLikesCheez merged 5 commits into
mainfrom
cursor/food-admin-enhancements-9adc
Nov 26, 2026
Merged

NinjaLikesCheez merged 5 commits into
mainfrom
cursor/food-admin-enhancements-9adc

Conversation

@NinjaLikesCheez

@NinjaLikesCheez NinjaLikesCheez commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #236

Overview

Implements the three requested admin enhancements for the /food panel from member feedback (Sentry PIXEL-29):

  1. Empty wishlist - Clear all items at once with confirmation
  2. Empty out-of-stock list - Clear all items at once with confirmation
  3. Comments system - Admin-only notes on wishlist items

Admin actions are staged so the home panel stays uncluttered: one Admin tools… button opens a short menu, then the action you need.

UX flow

Home (/food) — members see the usual add / remove / out-of-stock controls. Admins get one extra button:

  • Admin tools…

Admin tools → choose a area:

  • Wishlist…
  • Out of stock…

Wishlist tools →

  • Remove an item…
  • Comments…
  • Empty the wishlist… (confirm: cannot be undone)

Out of stock tools →

  • Clear an item…
  • Empty the list… (confirm: cannot be undone)

Comments… → pick an item → add / edit / remove comments for that item.

On the home wishlist, admins only see a compact 💬 N count; full comment text lives in the Comments flow.

Changes

Empty Lists

  • Confirmation panel with item count and This cannot be undone
  • Danger-styled Yes + Cancel (Cancel returns to the relevant tools panel)

Comments

  • Admin-only view / add / edit / remove
  • Multiple per item, 250 characters each
  • Stored on wishlist items in data/food-wishlist.yaml (not carried to out-of-stock)
  • Select menus capped at 25 options (Discord limit) with a notice when there are more

Data / service

  • Comment type and WishlistItem.comments?
  • emptyWishlist(), emptyOutOfStock(), addComment(), editComment(), removeComment()

Testing

  • Service and feature tests covering empty lists, comment CRUD, staged admin panels, and permission refusals
  • Coverage thresholds maintained

Security

  • New actions enforce admin checks in handlers
  • Comments never logged (only event name, item name, actor fields)
  • Text escaped with escapeMarkdown before display
Open in Web Open in Cursor 

- Add two new admin buttons to empty wishlist or out-of-stock list
  - Both show confirmation with danger button before clearing
  - Mention that the action cannot be undone
- Add comments system (admin-only, as requested)
  - Admins can add, edit, and remove comments on wishlist items
  - Multiple comments per item supported
  - 250 character limit per comment
  - Comments shown inline beneath items (💬 emoji + author + relative time)
  - Comments visible only to admins
  - Comments stored in wishlist items only (not carried to out-of-stock)
- Data model: Add Comment type with text, author, addedAt
- Service layer: Add emptyWishlist(), emptyOutOfStock(), addComment(),
  editComment(), removeComment() methods
- UI: New 'Manage comments' button opens item picker → comment management panel
- Tests: Full coverage for all new functionality (56 service tests, 79 feature tests)

Closes #236

Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
Comment thread src/features/food/index.ts Resolved
Comment thread src/features/food/index.ts Resolved
Comment thread src/features/food/index.ts Resolved
cursoragent and others added 4 commits November 25, 2026 07:08
- Add CHANGELOG.md entry for new admin tools
- Fix form submissions to include item/index in submit args
- Replace unsupported 'prefill' with field 'value' property
- Limit comment selects to 25 options (Discord max)
- Fix relative time formatting for 360-364 day range
- Add optional chaining for TypeScript strictness
- Convert forms to functions to properly pass context

Fixes all CI failures and addresses Sentry bugs:
- HIGH: Forms now pass required args on submit
- MEDIUM: Comment selects capped at 25 (shows notice if more)
- LOW: Time formatting no longer shows '0 years ago'

Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
- Add tests for empty wishlist and out-of-stock actions
- Add tests for comment CRUD operations (add, edit, remove)
- Add tests for admin-only checks
- Add tests for error conditions and edge cases
- Add test for 25-comment select limit
- Improve coverage from 66% to 91% for food feature

Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
- Add tests for comment validation (over 250 chars, empty text)
- Add tests for missing/nonexistent items in comment operations
- Add tests for invalid indices and out-of-bounds access
- Add tests for empty list edge cases
- Add tests for picker panel fallback
- Brings coverage to 92.8% lines, 82% functions (passing thresholds)

Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
Replace the five admin buttons on /food with a single Admin tools…
entry that drills into Wishlist… / Out of stock… panels. Show only a
compact comment count on the home wishlist; full comments stay in the
Comments… flow.

Co-authored-by: NinjaLikesCheez <NinjaLikesCheez@users.noreply.github.com>
@NinjaLikesCheez
NinjaLikesCheez merged commit c30c000 into main Nov 26, 2026
5 checks passed
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.

/food: admin tools to clear the wishlist and add comments to items

2 participants