From: Benjamin Auder Date: Tue, 21 Jan 2020 10:01:14 +0000 (+0100) Subject: Fix chat issues when launching a game X-Git-Url: https://git.auder.net/js/pieces/%7B%7B%20asset%28%27mixstore/css/DESCRIPTION?a=commitdiff_plain;h=c97830ea3ee97c6c408c62dab6c59da46cfd03d5;p=vchess.git Fix chat issues when launching a game --- diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 60f62917..e0910c0c 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -8,7 +8,7 @@ main p(v-html="infoMessage") input#modalNewgame.modal(type="checkbox") div(role="dialog" aria-labelledby="titleFenedit") - .card.smallpad + .card.smallpad(@keyup.enter="newChallenge") label#closeNewgame.modal-close(for="modalNewgame") fieldset label(for="selectVariant") {{ st.tr["Variant"] }} diff --git a/server/sockets.js b/server/sockets.js index 891c516d..3b166530 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -110,7 +110,9 @@ module.exports = function(wss) { } break; case "newchat": - notifyRoom(query["page"], "newchat", {msg:obj.msg, name:obj.name}); + // WARNING: do not use query["page"], because the page may change + notifyRoom(clients[sid].page, "newchat", + {msg: obj.msg, name: obj.name}); break; // TODO: WebRTC instead in this case (most demanding?) case "newmove":