From 39e1a4d13650dba660d04c404f28d3dde27df660 Mon Sep 17 00:00:00 2001 From: Thesourtimes Date: Tue, 7 Dec 2021 17:35:55 +0300 Subject: [PATCH 1/3] Fix previous commit --- api/src/routes/invites/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/routes/invites/index.ts b/api/src/routes/invites/index.ts index c327a63e..a9ec2421 100644 --- a/api/src/routes/invites/index.ts +++ b/api/src/routes/invites/index.ts @@ -15,7 +15,7 @@ router.get("/:code", route({}), async (req: Request, res: Response) => { router.post("/:code", route({}), async (req: Request, res: Response) => { const { code } = req.params; - const { features } = await Guild.findOneOrFail({where: { code }}); + const { features } = await Guild.findOneOrFail({ id: (await Invite.findOneOrFail({ code })).guild_id}); const { public_flags } = await User.findOneOrFail({ id: req.user_id }); if(features.includes("INTERNAL_EMPLOYEE_ONLY") && (public_flags & 1) !== 1) throw new HTTPError("You are not allowed to join this guild.", 401) From bf7f7ec74c571801d478dae9c45e67dc1c71ba23 Mon Sep 17 00:00:00 2001 From: Kuna <65683493+Thesourtimes@users.noreply.github.com> Date: Tue, 7 Dec 2021 19:39:03 +0300 Subject: [PATCH 2/3] Update index.ts --- api/src/routes/invites/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/src/routes/invites/index.ts b/api/src/routes/invites/index.ts index a9ec2421..a237ea90 100644 --- a/api/src/routes/invites/index.ts +++ b/api/src/routes/invites/index.ts @@ -15,7 +15,8 @@ router.get("/:code", route({}), async (req: Request, res: Response) => { router.post("/:code", route({}), async (req: Request, res: Response) => { const { code } = req.params; - const { features } = await Guild.findOneOrFail({ id: (await Invite.findOneOrFail({ code })).guild_id}); + const { guild_id } = await Invite.findOneOrFail({ code }) + const { features } = await Guild.findOneOrFail({ id: guild_id}); const { public_flags } = await User.findOneOrFail({ id: req.user_id }); if(features.includes("INTERNAL_EMPLOYEE_ONLY") && (public_flags & 1) !== 1) throw new HTTPError("You are not allowed to join this guild.", 401) From 54a53e06b12f96bf58519bf347b951035b04a22f Mon Sep 17 00:00:00 2001 From: Kuna <65683493+Thesourtimes@users.noreply.github.com> Date: Tue, 7 Dec 2021 19:40:09 +0300 Subject: [PATCH 3/3] Update index.ts --- api/src/routes/invites/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/routes/invites/index.ts b/api/src/routes/invites/index.ts index a237ea90..a2cf4cb5 100644 --- a/api/src/routes/invites/index.ts +++ b/api/src/routes/invites/index.ts @@ -15,7 +15,7 @@ router.get("/:code", route({}), async (req: Request, res: Response) => { router.post("/:code", route({}), async (req: Request, res: Response) => { const { code } = req.params; - const { guild_id } = await Invite.findOneOrFail({ code }) + const { guild_id } = await Invite.findOneOrFail({ code }) const { features } = await Guild.findOneOrFail({ id: guild_id}); const { public_flags } = await User.findOneOrFail({ id: req.user_id });