Skip to content

Stop the appeal page reporting TripBot's refusals as successes (#208) - #504

Merged
tripsit-release-promotion[bot] merged 1 commit into
uatfrom
fix/208-appeal
Nov 27, 2026
Merged

tripsit-release-promotion[bot] merged 1 commit into
uatfrom
fix/208-appeal

Conversation

@LunaUrsa

Copy link
Copy Markdown
Contributor

Summary

Closes #208.

TripBot's appeal API (the same on uat and main) answers several refusals with HTTP 200 and success: false. The appeal page only checked the status, so it told people things had worked when they hadn't:

What happened Before Now
TripBot can't reach Discord to check the ban: /users/banned sends { success: false, banned: false } A banned person saw "Not Banned: there's nothing to appeal!" and had no way to appeal The existing "We couldn't check your ban status" screen with Try again
An appeal is refused: COOLDOWN, USER_NOT_FOUND, DATABASE_ERROR, NOT_BANNED A green alert ("Failed to create appeal due to a server error"), then the form came back empty A red error with the reason. The form keeps the answers. Someone who's no longer banned is taken to the not-banned page
A reminder fails: "Something went wrong. Your reminder was not sent." Green, because the colour came from whether the text contained "sent" Coloured by the result
Banned again within 3 months of an accepted appeal Offered the form, which TripBot then refused (its wait counts from the last appeal, whatever its outcome) An "Appeal Again Later" page with the date they can appeal from

The friendly-message mapping for "User not found in database" and the server-error text already existed but never fired for these refusals. TripBot sends those strings in message, and the page was reading error. It now reads message for a refusal sent with a 200, and error for a refusal sent with an error status.

The staff review screen needed no change: TripBot's staff routes report failures with 4xx/5xx statuses, and AppealReview already checks response.ok.

Not changed: a denied appeal still unlocks 3 months after the decision, as the page says. TripBot would accept one 3 months after the submission, so the page is the stricter of the two. That's a policy choice, not a bug.

TripBot side: /users/banned turning a failed check into banned: false is also worth fixing in TripBot itself, by sending a 5xx. This PR doesn't depend on that, and the page handles both forms.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / chore
  • Other (describe above)

Checklist

  • Branch is up to date with uat (this PR targets uat, not main)
  • Lint passes (npx eslint .)
  • npx next build succeeds locally (also type-checks)
  • No secrets, .env values, or user data included

Test plan

  • New tests in AppealPage.test.tsx use TripBot's real response bodies (from src/api/v2/appeals/appeals.routes.ts and src/api/v2/users/users.routes.ts): refused appeals for each code, the not-banned refusal, reminder outcomes, ban checks with success: false or no banned flag, and the accepted-appeal wait checked exactly at the 3-month boundary.
  • Against the page as it is on uat, 10 of these tests fail, one per defect path. With this change, all 78 tests in the file pass.
  • npx jest: 66 suites, 593 tests pass. npx eslint . and Prettier are clean. npx next build succeeds.
  • Not tried end to end with a banned Discord account against a live TripBot.

🤖 Generated with Claude Code

TripBot answers several refusals with a 200 and success: false, and the
appeal page only checked the status:

- A failed ban check ({ success: false, banned: false }, sent when TripBot
  can't reach Discord) showed banned people "Not Banned: there's nothing to
  appeal". It now shows the "couldn't check your ban status" retry screen.
- A refused appeal (cooldown, user not found, database error, not banned)
  showed a green success message and then an empty form, losing the
  answers. It now shows the reason as an error and keeps the answers; a
  user who is no longer banned is taken to the not-banned page.
- A failed reminder ("Your reminder was not sent.") was coloured green
  because the colour came from the word "sent". It now follows the result.
- Someone banned again within 3 months of an accepted appeal was offered a
  form TripBot would refuse (its wait counts from the last appeal, whatever
  became of it). They now see the date they can appeal from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tripsit-release-promotion
tripsit-release-promotion Bot added this pull request to the merge queue Nov 27, 2026
Merged via the queue into uat with commit 890585c Nov 27, 2026
12 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 27, 2026
@LunaUrsa
LunaUrsa deleted the fix/208-appeal branch November 28, 2026 18:23
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.

Ban Appeal Fixes

1 participant