summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-08-30 06:30:53 +0200
committerRory& <root@rory.gay>2026-08-30 06:30:53 +0200
commit9c5eb62be7b51bd56cf2ca82e18f94cc3ed5cbdc (patch)
tree03138e5af209a7f889baef6c31335582f6bf5a12 /src/api
parentFix a typo (diff)
parentfix: Add character limit for pronouns (diff)
downloadserver-ts-9c5eb62be7b51bd56cf2ca82e18f94cc3ed5cbdc.tar.xz
Merge remote-tracking branch 'Vespe-r/fix/pronouns_length_limit'
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/users/#user_id/profile.ts12
1 files changed, 12 insertions, 0 deletions
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();