diff --git a/assets/openapi.json b/assets/openapi.json index b147fc36a..f51ef3805 100644 Binary files a/assets/openapi.json and b/assets/openapi.json differ diff --git a/assets/schemas.json b/assets/schemas.json index fa1337109..40474e02c 100644 Binary files a/assets/schemas.json and b/assets/schemas.json differ diff --git a/src/api/routes/users/#user_id/profile.ts b/src/api/routes/users/#user_id/profile.ts index 1db2a63da..ef7ff0e8c 100644 --- a/src/api/routes/users/#user_id/profile.ts +++ b/src/api/routes/users/#user_id/profile.ts @@ -187,6 +187,18 @@ router.patch("/", route({ requestBody: "UserProfileModifySchema" }), async (req: } } + if (body.pronouns) { + const { maxPronouns } = Config.get().limits.user; + if (body.pronouns.length > maxPronouns) { + throw FieldErrors({ + pronouns: { + code: "PRONOUNS_INVALID", + message: `Pronouns must be less than ${maxPronouns} in length`, + }, + }); + } + } + user.assign(body); await user.save(); diff --git a/src/util/config/types/subconfigurations/limits/UserLimits.ts b/src/util/config/types/subconfigurations/limits/UserLimits.ts index cbe686d14..8a9647cc6 100644 --- a/src/util/config/types/subconfigurations/limits/UserLimits.ts +++ b/src/util/config/types/subconfigurations/limits/UserLimits.ts @@ -21,4 +21,5 @@ export class UserLimits { maxUsername: number = 32; maxFriends: number = 5000; maxBio: number = 190; + maxPronouns: number = 40; }