X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=edaca5c1dffab1c60630481f18317263f72fd041;hb=5bcc9b31a762645af3d35192e7359771c95d4ff7;hp=e6cb1e70a3dff14096b84a579bc7c70abf10744e;hpb=41c80bb63b85b2696d3925c10784c3d7bb5d2aa3;p=vchess.git diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index e6cb1e70..edaca5c1 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -10,16 +10,18 @@ main .row #aboveBoard.col-sm-12.col-md-9.col-md-offset-3.col-lg-10.col-lg-offset-2 button#chatBtn(onClick="doClick('modalChat')") Chat - #actions(v-if="game.mode!='analyze' && game.score=='*'") + #actions(v-if="game.score=='*'") button(@click="clickDraw" :class="{['draw-' + drawOffer]: true}") Draw button(@click="abortGame") Abort button(@click="resign") Resign #playersInfo p - span.name(:class="{connected: isConnected(0)}") {{ game.players[0].name }} + span.name(:class="{connected: isConnected(0)}") + | {{ game.players[0].name || "@nonymous" }} span.time(v-if="game.score=='*'") {{ virtualClocks[0] }} span.split-names - - span.name(:class="{connected: isConnected(1)}") {{ game.players[1].name }} + span.name(:class="{connected: isConnected(1)}") + | {{ game.players[1].name || "@nonymous" }} span.time(v-if="game.score=='*'") {{ virtualClocks[1] }} BaseGame(:game="game" :vr="vr" ref="basegame" @newmove="processMove" @gameover="gameOver") @@ -214,7 +216,9 @@ export default { break; } case "askgame": - // Send current (live) game + // Send current (live) game if not asked by opponent (!) + if (this.game.players.some(p => p.sid == data.from)) + return; const myGame = { // Minimal game informations: @@ -551,7 +555,8 @@ export default { document.getElementById("chatBtn").style.backgroundColor = "#e2e2e2"; }, finishSendChat: function(chat) { - if (this.game.type == "corr") + // NOTE: anonymous chats in corr games are not stored on server (TODO?) + if (this.game.type == "corr" && this.st.user.id > 0) GameStorage.update(this.gameRef.id, {chat: chat}); }, processChat: function() { @@ -559,7 +564,6 @@ export default { document.getElementById("chatBtn").style.backgroundColor = "#c5fefe"; }, gameOver: function(score, scoreMsg) { - this.game.mode = "analyze"; this.game.score = score; this.game.scoreMsg = scoreMsg; const myIdx = this.game.players.findIndex(p => {