diff options
author | Puyodead1 <puyodead@protonmail.com> | 2022-11-03 09:30:20 -0400 |
---|---|---|
committer | Puyodead1 <puyodead@protonmail.com> | 2022-11-03 09:30:20 -0400 |
commit | 6c1af6af4f360b261b3a4c281683dd5c2c1db802 (patch) | |
tree | c32ef28e92b9f0c5cb4c0a7871271bf802e5ce85 | |
parent | Merge pull request #891 from fosscord/dev/improve-security (diff) | |
download | server-6c1af6af4f360b261b3a4c281683dd5c2c1db802.tar.xz |
fix adding roles to users
-rw-r--r-- | src/api/routes/guilds/#guild_id/members/#member_id/index.ts | 3 |
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); |