Repository navigation
fix(admin): a dashboard change posted without a reason is refused on its page - #683
Draft
PiquelChips wants to merge 2 commits into
Draft
PiquelChips wants to merge 2 commits into
PiquelChips wants to merge 2 commits into
Conversation
…its page The handle reservation, the account's settings tabs, and the handle and display name pages failed to decode a form without a reason field, so the dashboard answered a bare 400. Their reason now defaults to empty, as the other forms' do, and the page asks for it again.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…ered The test now posts without a reason to the account's handle and display name pages and its emails tab, and unreserves a handle that is reserved, checking that nothing changes. The surfaces page says what is stored.
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.
Part of #544 (NEW-7, first half).
The admin dashboard's change forms disagreed about a POST with no
reasonfield. Most showed the page again with "Give a reason of 1 to 500 characters…", but four failed to decode the form and answered a bare400("invalid form value: missing fieldreason"), with no page around it.Now every form defaults a missing reason to empty, so
Reason::parserefuses it on the page, exactly as it refuses a blank one.Visible change: posting one of these changes without a
reasonfield now answers the change's page at400, with the reason message and the form as typed, instead of a bare decode error:/handles/reserve/users/{account}/handleand/users/{account}/name/users/{account}/sign-in,/profile,/emailsand/appsBrowsers always send the field, since every form renders a
reasoninput, so the change only shows for hand-made or scripted requests.Side effect on
GET: the extractor reads aGET's query as the form, so a query without areasonused to fail too.GET /handles/reserve?handle=xandGET /users/{account}/handle?handle=x(or/name?display_name=x) answered a bare400; now they show the form, as a plainGETdoes. A query never changes anything.Test:
a_change_without_a_reason_is_refused_on_its_pageposts with no reason to every form that used to fail decoding:/handles/reserve, the account's/handleand/namepages, and its/emailstab, which decodes through its own path (App::posted). It also posts to/handles/unreserve, whoseReasonFormalready defaulted. Each answers400on its page with the reason message. Then the test checks that nothing changed: the handle reserved first is still listed, nothing new is reserved, and the account's handle, display name and address are as they were. With the settings tabs' default removed, the test fails.Docs:
docs/dev/architecture/surfaces.md(what a dashboard change without a reason gets) anddocs/dev/extending/admin-operation.md(forms default their reason).The follow-up refactor, stacked on this PR, folds the forms into one
Administered<C>wrapper.Note
Written by Claude Opus 5.5 in Claude Code and reviewed by Claude Opus 5.5 (via T3 Code)