fix: allow 0 length about-mes

This commit is contained in:
zkldi
2022-07-17 21:39:47 +01:00
parent cb397be104
commit 44bd12e7a8
4 changed files with 4 additions and 3 deletions
@@ -34,7 +34,7 @@ function AboutMeCard({ reqUser }: Props) {
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ about: content }),
body: JSON.stringify({ about: content.length === 0 ? null : content }),
},
true,
true
@@ -336,6 +336,7 @@ function SocialMediaForm({ reqUser }: { reqUser: PublicUserDocument }) {
},
onSubmit: async (values) => {
const valuesClone: Record<string, string | null> = {};
for (const v in values) {
const vx = v as keyof typeof values;
valuesClone[vx] = values[vx] || null;
+1 -1
View File
@@ -986,7 +986,7 @@ const PRE_SCHEMAS = {
twitch: "*?string",
},
joinDate: p.isPositiveInteger,
about: p.isBoundedString(0, 4000),
about: p.isBoundedString(0, 2000),
status: p.nullable(p.isBoundedString(3, 140)),
customPfpLocation: "?string",
customBannerLocation: "?string",
@@ -77,7 +77,7 @@ router.patch(
"/",
RequireSelfRequestFromUser,
prValidate({
about: p.optional(p.isBoundedString(3, 2000)),
about: p.optional(p.isBoundedString(0, 2000)),
status: optNullFluffStrField,
discord: optNullFluffStrField,
twitter: optNullFluffStrField,