summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-25 00:04:21 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-09-25 00:04:21 +1000
commit5cd152e3a9625c8551681ca0fb4780df2e9149c8 (patch)
treeccc8b2e095d222ef5a9028079e15d23223ac8eff
parentFix default rights sucking, fix patch /guilds/:id/members/:id not checking pe... (diff)
downloadserver-5cd152e3a9625c8551681ca0fb4780df2e9149c8.tar.xz
Potential nick reset fix
-rw-r--r--api/src/routes/guilds/#guild_id/members/#member_id/index.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
index b6314ec0..d923c10f 100644
--- a/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
+++ b/api/src/routes/guilds/#guild_id/members/#member_id/index.ts
@@ -35,9 +35,9 @@ router.patch("/", route({ body: "MemberChangeSchema" }), async (req: Request, re
 		member.roles = body.roles.map((x) => new Role({ id: x })); // foreign key constraint will fail if role doesn't exist
 	}
 
-	if (body.nick) {
+	if ('nick' in body) {
 		permission.hasThrow(req.user_id == member.user.id ? "CHANGE_NICKNAME" : "MANAGE_NICKNAMES");
-		member.nick = body.nick;
+		member.nick = body.nick?.trim() || undefined;
 	}
 
 	await member.save();