Fix inventors note for Copycat
[vchess.git] / client / src / views / Hall.vue
index 7d7f234..c6b00d4 100644 (file)
@@ -315,20 +315,24 @@ export default {
         // Automatic challenge sending, for tournaments
         this.loadNewchallVariant(
           () => {
-            this.newchallenge = {
-              fen: "",
-              vid:
-                this.st.variants
-                .find(v => v.name == this.$route.query["variant"])
-                .id,
-              to: this.$route.query["challenge"],
-              color: this.$route.query["color"] || '',
-              cadence: this.$route.query["cadence"],
-              // Tournament: no randomness (TODO: for now at least)
-              randomness: 0,
-              memorize: false
-            };
-            this.issueNewChallenge();
+            this.newchallenge = Object.assign(
+              this.newchallenge,
+              {
+                fen: "",
+                vid:
+                  this.st.variants
+                  .find(v => v.name == this.$route.query["variant"])
+                  .id,
+                to: this.$route.query["challenge"],
+                color: this.$route.query["color"] || '',
+                cadence: this.$route.query["cadence"],
+                // Tournament: no randomness (TODO: for now at least)
+                randomness: 0,
+                memorize: false
+              }
+            );
+            window.doClick("modalNewgame");
+            //this.issueNewChallenge(); //NOTE: doesn't work yet.
           },
           this.$route.query["variant"]
         );
@@ -982,7 +986,7 @@ export default {
             .getElementById("btnC" + newChall.type)
             .classList.add("somethingnew");
         }
-        if (chall.to == this.st.user.name) {
+        if (!!chall.to && chall.to == this.st.user.name) {
           notify(
             "New challenge",
             // fromValues.name should exist since the player is online, but
@@ -1305,6 +1309,7 @@ export default {
         // on game just after, the main Hall will be notified.
       };
       if (c.type == "live") {
+        // TODO: ask my IP + opp IP, to add to game infos? (potential bans)
         notifyNewgame();
         this.startNewGame(gameInfo);
         // Increment game stats counter in DB