Repository navigation
feat(bot): redesign case menus, command browser and status replies - #421
Conversation
/case list answered with one page of an embed, picked with options. It now opens a menu: a select menu filters the cases, the buttons go from a page to another and open a case with the actions on it. The answers of the case commands take the shape of renderStatus, the one every status message of the bot is moving to.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #421 +/- ##
==========================================
+ Coverage 62.33% 62.88% +0.54%
==========================================
Files 280 287 +7
Lines 9944 10246 +302
Branches 2367 2456 +89
==========================================
+ Hits 6199 6443 +244
- Misses 3329 3367 +38
- Partials 416 436 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A case could only be changed with one command for each change, and nothing kept who changed what. The case now has buttons: Edit and Close open a modal, History lists the edits, Delete asks first. The moderators can add a note only they read and a proof, and can tell the user about an edit in a direct message. The note, the proof and the history are new columns and a new table of the contract.
The commands menu was ephemeral, its search replaced the menu, and the command took a search option that did the same as the button. The menu is now a message the channel sees, the search answers under it with a message only who searched sees, and the option is gone. A description sat an empty line under its command: Discord draws one after a line that is all bold, so only the number is bold now.
|
Agent verification: opened the case list, case detail, Edit and Close modals, empty History, and Delete confirmation in Discord staging. Cancelled all actions on the existing case. These screenshots cover the earlier staging image. The live /commands check still showed the previous private menu and search option, so staging verification must be repeated with the e07be3b image before marking this PR ready. |
The answer of a moderation command said the case it made, the direct message of the user was an embed of fields, and the confirmation after a recent case was a line of text. They now take the shape of Flamey: what was done to whom with the emoji of the type, a container in the colour of the type for the user, and a prompt with Proceed and Cancel. The options follow Flamey too: dm is notify, and proof and note keep a file and a staff note with the case. The roles menu loses its bar.
Discord quotes the whole rest of a message after >>>, so the note under the reason of a case read as a literal >>>, and the appeal and the footer of a direct message were quoted with its reason.
Two moderators editing a case on two processes both recorded the old value, so edits now take the shared lock of the case. A note of many short lines grew past the 4000 characters of a message once quoted, so it is cut after quoting. A recent case prompt sent before the update is a classic message, and its answer still empties it.
The menus mixed the icons of the bot with Unicode emojis: a magnifying glass, folders, a lock, a bin, a chart, a speech bubble, a minus. They are now application emojis drawn in the style of the others, from the Discord assets where it has one, and the search of the roles menu sits on the right of its title, as the one of the commands menu does.
1bcc19d to
c4900b3
Compare
Architecture Inside the changed components — 1 viewComponent view — Case management UI Detailed interaction flow and rendering modules for moderation cases
Data flow Data model Tip The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change 🪧 More tips
Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it. |
There was a problem hiding this comment.
Important
The case edit lock does not protect what it claims to, because the case is read before the lock is taken.
Approach: sound. Case editing goes through one shared editCase/closeCase path with its own history table, and the status replies share one renderer, so the commands and menus stay consistent.
Reviewed changes
Read the complete diff at c4900b3, except the generated emoji assets and migration snapshots.
- Case menu —
/case listand/case viewrender Components V2 menus (lib/structures/case-menu), driven by thecaseMenuinteraction handler. The handler is stateless, andcommandsEnablednow also gates thecaseMenuhandler against thecasecommand. - Case edits —
lib/moderation/caseEdits.tsaddseditCase,closeCaseandaddCaseDetails, with a history table (ModerationCaseEdit, capped at 50 per case).ModerationCaseDatagainsstaff_noteand proof columns, added by migration20261126T1759_add_case_details_and_edits. - Moderation commands — New
proofandnoteoptions;dmis renamednotify. The answer, the user's direct message and the recent-case prompt are redrawn. - Status replies —
lib/utilities/status.tsgives info, success, warning and error containers. Most handlers and commands move to it mechanically. /commands— The menu is public, thecommandoption is gone, and search results are a separate ephemeral message.
ℹ️ /case list also loses type, pending-only and page, which the PR does not list as breaking
The description lists the /commands command option and the dm → notify rename as breaking changes. /case list also drops its type, pending-only and page options in favour of the menu's select and pagination, which src/@types/commands.d.ts confirms. Anyone with saved usage of those options, or documentation that names them, will see them vanish.
Technical details
# Undocumented breaking option removals on `/case list`
## Affected sites
- `projects/bot/src/commands/Moderation/Utilities/case/list.ts` — `type`, `pending-only` and `page` options removed from the builder.
- PR description, "Breaking Changes" section — mentions only `/commands command` and `dm` → `notify`.
## Required outcome
- Add the removed `/case list` options to the breaking changes section, or confirm they are intentionally dropped.claude-sonnet-5-5 | 𝕏
The lock of a case can be waited on for up to 10 seconds. Discord gives an interaction 3 seconds to answer.
There was a problem hiding this comment.
ℹ️ No new issues in this delta. The three threads from the previous review are untouched by it and stay open.
Reviewed changes
Reviewed the one commit since the prior pullfrog review (f276770).
- Deferred case edit and archive —
/case editand/case archivenow callinteraction.defer({ flags: MessageFlags.Ephemeral })beforeeditCase/closeCaseand answer withdeferred.update(...), so waiting for the case lock cannot pass the 3 second window.resolveCaseDurationstill throws before the defer, so its string errors reachhandleCase'sinteraction.replywhile the interaction is unacknowledged.
The open threads on the stale entry read outside the lock (caseEdits.ts), the missing try/catch after deferUpdate() (caseMenu.ts) and the proof fetch before the first response (case/view.ts) are not addressed by this commit.
claude-sonnet-5-5 | 𝕏
# Conflicts: # projects/database/migrations/app/refs/db.json
Review of #421: the case was written back from the cache of the process, the proof upload could outlast the lock, the view replied after a request to Discord, a failed modal edit left no answer, and the direct message of an edit ignored the opt-out of /settings user.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the one commit since the prior pullfrog review (9d2f0f1, "read cases under their lock and defer the case views"). It addresses the three threads from the earlier review, which are already resolved.
- Case read under its lock —
editCaseandcloseCasecall the newModerationManager#refetchinsidewithCaseLock, sobeforevalues, thedurationfallback andisArchived()come from the database instead of the process cache. The entry is patched in place by#performUpdate, so the outcome'sentrycarries the new values. - Proof and direct message off the lock — the proof is downloaded and re-uploaded before the lock is taken, and the user is told after it is released (
notifyCaseUserWithWarning). A user who turned off moderation messages now gets anoptedOutwarning instead of a message. - Deleted cases — both functions return
nullwhen the case is gone, and/case edit,/case archiveand the menu answer withcaseUnknownEntry. - Deferred case views —
/case view, theviewverb anddeleteCanceldefer before reading the proof message. The modal submits incaseMenuwrapeditCase/closeCaseintry/catchand answer throughfailAfterDefer. - Tests —
caseNotifications.test.tscovers the stale cache, a case deleted meanwhile, a case closed elsewhere and the opted-out user.
claude-sonnet-5-5 | 𝕏

🔗 Linked issue
❓ Type of change
📚 Description
Moderators can browse and manage cases from one menu, with a layout matching the supplied Discord screenshots.
/case listhas filters, pagination and a button for each case. Details offer edit, close, history and confirmed deletion./commandsopens a public menu. Its search button opens a modal and sends results separately below the menu.proofandnoteoptions keep a file and a staff note with the case./roles browsedrops its colour bar.The
commandoption of/commandsis removed. Use the menu's search button instead.The
dmoption of the moderation commands is renamednotify.📝 Migration
Apply
20261126T1759_add_case_details_and_editsbefore running the new bot against an existing database.The production image runs migrations during startup.
For a separately managed deployment, run
NODE_ENV=production pnpm --filter wolfstar-database migrate:deploywith its database configuration.This adds staff notes, proof references and edit history. It cannot reconstruct earlier edits.


Confidence Score: 5/5
The PR appears safe to merge; both numbered previous findings are fixed, and no new blocking issue was found.Reviews (17) · Last reviewed commit: "fix(bot): read cases under their lock an..." · Reviewed by Greptile