summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPuyodead1 <puyodead@proton.me>2023-12-14 09:36:40 -0500
committerPuyodead1 <puyodead@proton.me>2023-12-14 09:36:40 -0500
commita574284e9f1267dc46624872232aa686d49643b3 (patch)
tree8a18f82ac4004ae0afc7c2ace68fdc4ebd39802b /src
parentmember projection: select avatar (diff)
downloadserver-a574284e9f1267dc46624872232aa686d49643b3.tar.xz
GuildMemberPatch: remove a useless query
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/guilds/#guild_id/members/#member_id/index.ts8
1 files changed, 2 insertions, 6 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 c168f2dc..a1ee88d2 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
@@ -113,9 +113,6 @@ router.patch(
 			relations: ["roles", "user"],
 		});
 		const permission = await getPermission(req.user_id, guild_id);
-		const everyone = await Role.findOneOrFail({
-			where: { guild_id: guild_id, name: "@everyone", position: 0 },
-		});
 
 		if ("nick" in body) {
 			permission.hasThrow("MANAGE_NICKNAMES");
@@ -152,15 +149,14 @@ router.patch(
 			body.roles = body.roles || [];
 			body.roles.filter((x) => !!x);
 
-			if (body.roles.indexOf(everyone.id) === -1)
-				body.roles.push(everyone.id);
+			if (body.roles.indexOf(guild_id) === -1) body.roles.push(guild_id);
 			// foreign key constraint will fail if role doesn't exist
 			member.roles = body.roles.map((x) => Role.create({ id: x }));
 		}
 
 		await member.save();
 
-		member.roles = member.roles.filter((x) => x.id !== everyone.id);
+		member.roles = member.roles.filter((x) => x.id !== guild_id);
 
 		// do not use promise.all as we have to first write to db before emitting the event to catch errors
 		await emitEvent({