Fix failure when checking bans

Forgot to provide the userid to check to checkBan queries
master
Dessa Simpson 2020-09-17 11:29:05 -07:00
parent 7de73c9565
commit e5f96b966a
1 changed files with 2 additions and 2 deletions

View File

@ -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.");