From: Benjamin Auder Date: Thu, 20 Feb 2020 12:44:34 +0000 (+0100) Subject: Fix mistakes X-Git-Url: https://git.auder.net/%7B%7B%20asset%28%27mixstore/css/user/doc/pieces/common.css?a=commitdiff_plain;h=bc50b249eb255c2f55988be4b8d7b27addd72577;p=vchess.git Fix mistakes --- diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index e25fc5ec..90a9a9fa 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -466,9 +466,10 @@ export default { if (myIdx >= 0 && game.chats.length > 0) { // Did a chat message arrive after my last move? let vr_tmp = new V(game.fen); //start from last position + const flags = V.ParseFen(game.fen).flags; //may be undefined let dtLastMove = 0; for (let midx = game.moves.length - 1; midx >= 0; midx--) { - vr_tmp.undo(game.moves[midx].squares); + vr_tmp.undo(Object.assign({flags:flags}, game.moves[midx].squares)); if (vr_tmp.turn == mycolor) { dtLastMove = game.moves[midx].played; break; diff --git a/server/routes/games.js b/server/routes/games.js index 8bd9131e..c8de00dc 100644 --- a/server/routes/games.js +++ b/server/routes/games.js @@ -61,7 +61,7 @@ router.put("/games", access.logged, access.ajax, (req,res) => { if (gid.toString().match(/^[0-9]+$/) && GameModel.checkGameUpdate(obj)) { GameModel.getPlayers(gid, (err,players) => { - if (players.some(p => p.id == req.userId)) + if (players.some(p => p.uid == req.userId)) { GameModel.update(gid, obj); if (obj.move || obj.score)