Fix chat issues when launching a game
authorBenjamin Auder <benjamin.auder@somewhere>
Tue, 21 Jan 2020 10:01:14 +0000 (11:01 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Tue, 21 Jan 2020 10:01:14 +0000 (11:01 +0100)
client/src/views/Hall.vue
server/sockets.js

index 60f6291..e0910c0 100644 (file)
@@ -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"] }}
index 891c516..3b16653 100644 (file)
@@ -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":