diff --git a/assets/openapi.json b/assets/openapi.json
index b147fc36a..f51ef3805 100644
--- a/assets/openapi.json
+++ b/assets/openapi.json
@@ -14975,12 +14975,17 @@
"maxBio": {
"type": "integer",
"default": 190
+ },
+ "maxPronouns": {
+ "type": "integer",
+ "default": 40
}
},
"required": [
"maxBio",
"maxFriends",
"maxGuilds",
+ "maxPronouns",
"maxUsername"
]
},
diff --git a/assets/schemas.json b/assets/schemas.json
index fa1337109..40474e02c 100644
--- a/assets/schemas.json
+++ b/assets/schemas.json
@@ -15972,6 +15972,10 @@
"maxBio": {
"type": "integer",
"default": 190
+ },
+ "maxPronouns": {
+ "type": "integer",
+ "default": 40
}
},
"additionalProperties": false,
@@ -15979,6 +15983,7 @@
"maxBio",
"maxFriends",
"maxGuilds",
+ "maxPronouns",
"maxUsername"
],
"$schema": "http://json-schema.org/draft-07/schema#"
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;
}
|