From e5f96b966ad7dea1ccef7a25fa17ce7c4542f28e Mon Sep 17 00:00:00 2001 From: Dessa Simpson Date: Thu, 17 Sep 2020 11:29:05 -0700 Subject: [PATCH] Fix failure when checking bans Forgot to provide the userid to check to checkBan queries --- src/app.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index 3542f94..478dc1c 100644 --- a/src/app.ts +++ b/src/app.ts @@ -71,7 +71,7 @@ app.post("/api/addRequest", async (request, response) => { response.send("Must be logged in"); return; } - var banned = await db.query(queries.checkBan).then((result: pg.QueryResult) => result.rowCount > 0); + var banned = await db.query(Object.assign(queries.checkBan, { values: [request.session.user.id] })).then((result: pg.QueryResult) => result.rowCount > 0); if (banned) { response.status(401); response.send("You are banned; you may not add new requests."); @@ -192,7 +192,7 @@ app.post("/api/addVote", async (request,response) => { response.send("Must be logged in"); return; } - var banned = await db.query(queries.checkBan).then((result: pg.QueryResult) => result.rowCount > 0); + var banned = await db.query(Object.assign(queries.checkBan,{ values: [request.session.user.id] })).then((result: pg.QueryResult) => result.rowCount > 0); if (banned) { response.status(401); response.send("You are banned; you may not vote on requests.");