Repository navigation
Stop the appeal page reporting TripBot's refusals as successes (#208) - #504
Merged
Merged
Conversation
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>
Merged
7 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #208.
TripBot's appeal API (the same on
uatandmain) answers several refusals with HTTP 200 andsuccess: false. The appeal page only checked the status, so it told people things had worked when they hadn't:/users/bannedsends{ success: false, banned: false }COOLDOWN,USER_NOT_FOUND,DATABASE_ERROR,NOT_BANNEDThe 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 readingerror. It now readsmessagefor a refusal sent with a 200, anderrorfor 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
AppealReviewalready checksresponse.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/bannedturning a failed check intobanned: falseis 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
Checklist
uat(this PR targetsuat, notmain)npx eslint .)npx next buildsucceeds locally (also type-checks).envvalues, or user data includedTest plan
AppealPage.test.tsxuse TripBot's real response bodies (fromsrc/api/v2/appeals/appeals.routes.tsandsrc/api/v2/users/users.routes.ts): refused appeals for each code, the not-banned refusal, reminder outcomes, ban checks withsuccess: falseor nobannedflag, and the accepted-appeal wait checked exactly at the 3-month boundary.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 buildsucceeds.🤖 Generated with Claude Code