impr(friends): validate username on add friend (@fehmer) (#7059)

fixes #7058
This commit is contained in:
Christian Fehmer 2025-10-28 17:33:19 +01:00 committed by GitHub
parent caae0d404e
commit 1cf316a772
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,7 +26,7 @@ import { getAuthenticatedUser } from "../firebase";
import * as ServerConfiguration from "../ape/server-configuration";
import * as AuthEvent from "../observables/auth-event";
import { Connection } from "@monkeytype/schemas/connections";
import { Friend } from "@monkeytype/schemas/users";
import { Friend, UserNameSchema } from "@monkeytype/schemas/users";
import * as Loader from "../elements/loader";
const pageElement = $(".page.pageFriends");
@ -73,6 +73,7 @@ const addFriendModal = new SimpleModal({
type: "text",
initVal: "",
validation: {
schema: UserNameSchema,
isValid: async (name: string) => {
const checkNameResponse = await Ape.users.getNameAvailability({
params: { name: name },