summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-03 01:47:57 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-03 01:47:57 +1000
commit209e5c33df430fedb23c850056037db0a235baee (patch)
tree8a248e325f9936dae42ab27095dfda54cc4932dc /api
parentWhoops, syntax error (diff)
parentPerhaps a better nickname change implementation (diff)
downloadserver-209e5c33df430fedb23c850056037db0a235baee.tar.xz
Merge branch 'fix/nicknames' into slowcord
Diffstat (limited to 'api')
-rw-r--r--api/src/routes/guilds/#guild_id/members/#member_id/index.ts5
1 files changed, 4 insertions, 1 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 2ff89eae..9b6465f6 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,7 +35,10 @@ 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) member.nick = body.nick;
+	if ('nick' in body) {
+		permission.hasThrow("CHANGE_NICKNAME");
+		Member.changeNickname(member.id, member.guild.id, body.nick!);
+	}
 
 	await member.save();