fix: don't check for disallowed words when dealing with existing user names (@fehmer)#7949
Open
fehmer wants to merge 2 commits into
Open
fix: don't check for disallowed words when dealing with existing user names (@fehmer)#7949fehmer wants to merge 2 commits into
fehmer wants to merge 2 commits into
Conversation
Contributor
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a “username without disallowed-words filter” schema and switches lookup-style UI validations (search/profile navigation) to use it, so users can interact with legacy usernames that would now fail the profanity/disallowed-words check.
Changes:
- Add
UserNameWithoutFilterSchemaand refactorUserNameSchemato build on it. - Update profile lookup + command line profile search validation to use the unfiltered schema.
- Remove unused
isUsernameValidhelper + its schema import.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/schemas/src/users.ts | Introduces UserNameWithoutFilterSchema; reuses it inside UserNameSchema. |
| frontend/src/ts/utils/misc.ts | Removes unused UserNameSchema import and isUsernameValid. |
| frontend/src/ts/pages/friends.ts | Switches add-friend modal schema to unfiltered username validation. |
| frontend/src/ts/components/pages/profile/ProfileSearchPage.tsx | Uses unfiltered username schema for profile lookup form validation. |
| frontend/src/ts/commandline/lists/navigation.ts | Uses unfiltered username schema for command-line profile search validation. |
Comments suppressed due to low confidence (1)
frontend/src/ts/pages/friends.ts:59
addFriendModalstill usesApe.users.getNameAvailabilityfor remote validation. That endpoint’s path param schema isUserNameSchema(includes disallowed-words check), so legacy/disallowed usernames will still fail server-side validation even though the local schema was switched. For “existing user” validation, call the profile lookup endpoint (e.g.Ape.users.getProfilewithisUid:false) or introduce a dedicated existence-check endpoint that usesUserNameWithoutFilterSchema.
validation: {
schema: UserNameWithoutFilterSchema,
isValid: remoteValidation(
async (name) => Ape.users.getNameAvailability({ params: { name } }),
{ check: (data) => !data.available || "Unknown user" },
),
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.
No description provided.