From b51e687793aa9c752d9643cf7a9ac4c3dade6bd2 Mon Sep 17 00:00:00 2001 From: RealMANI <96433859+ImAaronFR@users.noreply.github.com> Date: Sun, 6 Mar 2022 12:20:47 +0330 Subject: [PATCH 1/3] [Fix] Changing bio and accent color --- api/src/routes/users/@me/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts index 5834921c..78e203a2 100644 --- a/api/src/routes/users/@me/index.ts +++ b/api/src/routes/users/@me/index.ts @@ -58,7 +58,7 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: } var check_username = body?.username?.replace(/\s/g, ''); - if(!check_username && !body?.avatar && !body?.banner) { + if(!check_username && !body?.avatar && !body?.banner && !body?.bio && !body?.accent_color) { throw FieldErrors({ username: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") } }); From fa750de6fb95fb483ec078f008a417ed166b8183 Mon Sep 17 00:00:00 2001 From: RealMANI <96433859+ImAaronFR@users.noreply.github.com> Date: Sun, 6 Mar 2022 12:37:16 +0330 Subject: [PATCH 2/3] Check username --- api/src/routes/users/@me/index.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts index 78e203a2..d32b44f9 100644 --- a/api/src/routes/users/@me/index.ts +++ b/api/src/routes/users/@me/index.ts @@ -57,12 +57,14 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: user.data.hash = await bcrypt.hash(body.new_password, 12); } - var check_username = body?.username?.replace(/\s/g, ''); - if(!check_username && !body?.avatar && !body?.banner && !body?.bio && !body?.accent_color) { - throw FieldErrors({ - username: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") } - }); - } + if(body.username){ + var check_username = body?.username?.replace(/\s/g, ''); + if(!check_username) { + throw FieldErrors({ + username: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") } + }); + } + } await user.save(); From c79d464186f1b206ae2634201591a91d49edb40c Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Tue, 8 Mar 2022 21:22:02 +1100 Subject: [PATCH 3/3] Changing Member.premium_since back from Date to number fixes an error in the Discord electron client related to rendering premium status. Client throws "Invalid time value", so I'm guessing it's something to do with premium_since not being the date format they want ( allegedly ISO8601, but works with a plain number, so wtf ) --- util/src/entities/Member.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts index 3c5f9db0..b7406881 100644 --- a/util/src/entities/Member.ts +++ b/util/src/entities/Member.ts @@ -86,7 +86,7 @@ export class Member extends BaseClassWithoutId { joined_at: Date; @Column({ nullable: true }) - premium_since?: Date; + premium_since?: number; @Column() deaf: boolean;