From bc50b249eb255c2f55988be4b8d7b27addd72577 Mon Sep 17 00:00:00 2001 From: Benjamin Auder <benjamin.auder@somewhere> Date: Thu, 20 Feb 2020 13:44:34 +0100 Subject: [PATCH] Fix mistakes --- client/src/views/Game.vue | 3 ++- server/routes/games.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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) -- 2.44.0