From: Benjamin Auder Date: Wed, 5 Feb 2020 17:51:36 +0000 (+0100) Subject: Small fixes X-Git-Url: https://git.auder.net/js/%7B%7B%20asset%28%27mixstore/css/current/git-favicon.png?a=commitdiff_plain;h=5fd5fb22de02ed6c585e86a1c3dda50ff6071d2f;p=vchess.git Small fixes --- diff --git a/client/src/components/GameList.vue b/client/src/components/GameList.vue index c1557a23..d0ea2f01 100644 --- a/client/src/components/GameList.vue +++ b/client/src/components/GameList.vue @@ -46,6 +46,7 @@ export default { || g.players[0].sid == this.st.user.sid ? "w" : "b"; + // I play in this game, so g.fen will be defined if (!!g.fen.match(" " + myColor + " ")) priority++; } diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index a7096e52..d366bb2d 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -223,19 +223,23 @@ export default { break; } case "askgame": - // Send current (live) game if not asked by opponent (!) - if (this.game.players.some(p => p.sid == data.from)) - return; - const myGame = + // Send current (live) game if I play in (not an observer), + // and not asked by opponent (!) + if (this.game.type == "live" + && this.game.players.some(p => p.sid == this.st.user.sid) + && this.game.players.every(p => p.sid != data.from)) { - // Minimal game informations: - id: this.game.id, - players: this.game.players, - vid: this.game.vid, - timeControl: this.game.timeControl, - }; - this.st.conn.send(JSON.stringify({code:"game", - game:myGame, target:data.from})); + const myGame = + { + // Minimal game informations: + id: this.game.id, + players: this.game.players, + vid: this.game.vid, + timeControl: this.game.timeControl, + }; + this.st.conn.send(JSON.stringify({code:"game", + game:myGame, target:data.from})); + } break; case "newmove": if (!!data.move.cancelDrawOffer) //opponent refuses draw