From 098cd7f19e9ac858df6d635e5f37d356c1d5b1fa Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Thu, 21 Nov 2019 12:28:21 +0100 Subject: [PATCH] 'update' --- client/src/views/Hall.vue | 2 ++ server/models/Game.js | 1 + server/routes/games.js | 6 +++--- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index ac2cb27e..c47e89f1 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -398,6 +398,8 @@ export default { if (!!error) return alert(error); const ctype = this.classifyObject(this.newchallenge); + if (ctype == "corr" && this.st.user.id <= 0) + return alert("Please log in to play correspondance games"); // NOTE: "from" information is not required here let chall = Object.assign({}, this.newchallenge); const finishAddChallenge = (cid,warnDisconnected) => { diff --git a/server/models/Game.js b/server/models/Game.js index 94056c57..954ffc40 100644 --- a/server/models/Game.js +++ b/server/models/Game.js @@ -104,6 +104,7 @@ const GameModel = db.run(query, (err,gameIds) => { if (!!err) return cb(err); + gameIds = gameIds || []; //might be empty let gameArray = []; gameIds.forEach(gidRow => { GameModel.getOne(gidRow["gid"], (err2,game) => { diff --git a/server/routes/games.js b/server/routes/games.js index d1f233bd..35a7f42f 100644 --- a/server/routes/games.js +++ b/server/routes/games.js @@ -56,9 +56,9 @@ router.get("/games", access.ajax, (req,res) => { const userId = req.query["uid"]; const excluded = !!req.query["excluded"]; GameModel.getByUser(userId, excluded, (err,games) => { - access.checkRequest(res, err, games, "Games not found", () => { - res.json({games: games}); - }); + if (!!err) + return res.json({errmsg: err.errmsg || err.toString()}); + res.json({games: games}); }); } }); -- 2.44.0