summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-31 16:37:21 +1100
committerGitHub <noreply@github.com>2022-12-31 16:37:21 +1100
commit67658540d7ec65bc0e4a95388281b6c2211a7689 (patch)
tree316c66db0701cc24f36de7e38061635eb9f4fa9e
parentMerge pull request #910 from Puyodead1/patch1 (diff)
parentMerge branch 'staging' into patch/roles (diff)
downloadserver-67658540d7ec65bc0e4a95388281b6c2211a7689.tar.xz
Merge pull request #906 from Puyodead1/patch/roles legacy-2
fix adding roles to users
-rw-r--r--src/api/routes/guilds/#guild_id/members/#member_id/index.ts3
1 files changed, 2 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 06474f3e..8fe7d7dc 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
@@ -39,7 +39,8 @@ router.patch("/", route({ body: "MemberChangeSchema" }), async (req: Request, re
 		permission.hasThrow("MANAGE_ROLES");
 
 		if (body.roles.indexOf(everyone.id) === -1) body.roles.push(everyone.id);
-		member.roles = body.roles.map((x) => OrmUtils.mergeDeep(new Role(), { id: x })); // foreign key constraint will fail if role doesn't exist
+		// member.roles = body.roles.map((x) => OrmUtils.mergeDeep(new Role(), { id: x })); // foreign key constraint will fail if role doesn't exist
+		body.roles = body.roles.map((x) => OrmUtils.mergeDeep(new Role(), { id: x }));
 	}
 
 	if (body.avatar) body.avatar = await handleFile(`/guilds/${guild_id}/users/${member_id}/avatars`, body.avatar as string);