Repository navigation
Only validate the address on the Admin User page when it changes - #1479
Merged
Merged
Conversation
Follows up #1469. Saving a member's name or email was still blocked when their stored address was incomplete or held only the legacy Address value, which is the case in the issue's error payload. The page also never loaded the validation scripts, so nothing fired on the client. - Skip address validation and updates when the submitted address matches the stored one, ignoring surrounding whitespace and line-ending style. - Load jQuery Validate on the page, with address required rules matching the server's. - Store a blank State as an empty string. A null State made EF read the whole owned ShippingAddress back as null. - Leave the addresses untouched when every field is blanked on a member with a ShippingAddress, instead of clearing only Member.Address. - Add length validation to the address fields so over-length values no longer reach the database. Fixes #1422 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ardalis
force-pushed
the
issue-1422-admin-address-validation
branch
from
November 2, 2026 03:28
0eb11aa to
8e33bf7
Compare
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.
Fixes #1422. Replaces draft #1423, which should be closed rather than merged.
Why
#1469 fixed the blank
userId, the raw JSON errors, and members with no address at all, but two parts of the issue were still open:Member.Addressvalue, couldn't have just their name or email changed. The issue's payload, where onlyAddressis missing, is this case.Changes
Server (
Pages/Admin/User.cshtml.cs)"". A null State made EF read the whole ownedShippingAddressback as null. This reproduced on SQLite with the same mapping, not on SQL Server.ShippingAddressleaves both addresses untouched. It used to clear onlyMember.Address.Shared model (
UserPersonalUpdateModel)[StringLength]limits matching the address columns, so over-length values get a validation error instead of a database exception. This also applies to the member profile page.[Required]stays, so that page's address rules are otherwise unchanged.Client (
Pages/Admin/User.cshtml,wwwroot/js/admin-user.js)StartDatemessages to the subscription modals, which now also validate on the client.Testing
AddressFieldLengthstests.DevBetterWeb.Tests, 154 unit.dotnet formatis clean for the changed C# files./Admin/User.Known limitations
ShippingAddress. The save succeeds and the address reappears, same as before this PR.MyProfile/Personalhas the same null State bug. It's outside this issue and isn't fixed here.Review
A separate agent reviewed the change; its findings and how each was handled are in the plan file.
/codex:review, required byCLAUDE.md, was not run because neither the plugin nor thecodexCLI was available.🤖 Generated with Claude Code