1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

🐛 fix wrong permission in delete invite

This commit is contained in:
Flam3rboy 2021-04-23 00:14:54 +02:00
parent b40d6b825b
commit 696ef6278a

View File

@ -21,7 +21,8 @@ router.delete("/:invite_code", async (req: Request, res: Response) => {
const { guild_id, channel_id } = invite;
const perms = await getPermission(req.user_id, guild_id, channel_id);
if (!perms.has("MANAGE_GUILD") || !perms.has("MANAGE_CHANNELS")) throw new HTTPError("You aren't allow", 401);
if (!perms.has("MANAGE_GUILD") && !perms.has("MANAGE_CHANNELS"))
throw new HTTPError("You missing the MANAGE_GUILD or MANAGE_CHANNELS permission", 401);
await InviteModel.deleteOne({ code }).exec();