Skip to content

fix: surface errors on moderation actions instead of silently closing dialog - #192

Open
sandeep-2536 wants to merge 1 commit into
vicharanashala:mainfrom
sandeep-2536:fix/admin-moderation-silent-failure
Open

fix: surface errors on moderation actions instead of silently closing dialog#192
sandeep-2536 wants to merge 1 commit into
vicharanashala:mainfrom
sandeep-2536:fix/admin-moderation-silent-failure

Conversation

@sandeep-2536

Copy link
Copy Markdown

What was broken

doAction in AdminModeration.tsx silently caught and discarded API errors.
When a warn/suspend/ban request failed, the modal still closed as if it had
succeeded — so an admin had no way to know the action didn't actually happen.

Fix

  • Errors are now surfaced to the admin instead of being swallowed
  • The modal/dialog only closes on confirmed success; it stays open on failure
    so the admin can retry, and the entered reason text is preserved
  • Added AdminModeration.test.tsx covering both the failure path (modal stays
    open, error shown) and the success path (modal closes, fields reset)

How this was found

Found via manual code review of the admin moderation flow, not from an
assigned GitHub issue.

Testing

  • Manually reproduced the failure path by blocking the moderation request in
    DevTools — confirmed error is shown and modal stays open
  • Confirmed the success path still works normally after unblocking
  • pnpm exec tsc --noEmit passes
  • pnpm test — new AdminModeration.test.tsx tests pass. Note: 3 unrelated
    test suites (api.test.ts, PremiumTee.test.ts, GoldenTicketDetailPage.test.tsx)
    fail on main as well, due to a pre-existing tooling error
    (jsTokens is not a function) unrelated to this change.

… dialog

Previously doAction swallowed API errors silently, so a failed
warn/suspend/ban still closed the modal, making admins believe
the action succeeded when it hadn't.
@sandeep-2536
sandeep-2536 force-pushed the fix/admin-moderation-silent-failure branch from 7e3824d to d82a079 Compare July 29, 2026 13:51
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.

1 participant