From cc50ebf47b0cb4b19b68436037eff20d96874b3e Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Sun, 5 Feb 2023 12:35:27 +1100 Subject: Fix being unable to unset nicknames Remove unwanted guild profile handler in cdn Fix rights check for bio/avatars of your own user --- src/api/routes/guilds/#guild_id/members/#member_id/index.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/api/routes') diff --git a/src/api/routes/guilds/#guild_id/members/#member_id/index.ts b/src/api/routes/guilds/#guild_id/members/#member_id/index.ts index d40f2772..6ac0dd3b 100644 --- a/src/api/routes/guilds/#guild_id/members/#member_id/index.ts +++ b/src/api/routes/guilds/#guild_id/members/#member_id/index.ts @@ -65,9 +65,19 @@ router.patch( if ("nick" in body) { permission.hasThrow("MANAGE_NICKNAMES"); + + if (!body.nick) { + delete body.nick; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + //@ts-ignore shut up + member.nick = null; // remove the nickname + } } - if (("bio" in body || "avatar" in body) && member_id != "@me") { + if ( + ("bio" in body || "avatar" in body) && + req.params.member_id != "@me" + ) { const rights = await getRights(req.user_id); rights.hasThrow("MANAGE_USERS"); } -- cgit 1.4.1