summary refs log tree commit diff
path: root/src/api/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes')
-rw-r--r--src/api/routes/guilds/#guild_id/members/#member_id/index.ts12
1 files changed, 11 insertions, 1 deletions
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");
 		}