From: Benjamin Auder Date: Tue, 2 Jul 2019 23:23:18 +0000 (+0200) Subject: Some fixes. TODO: challenge is lost if navigation to variants + back to hall. Ask... X-Git-Url: https://git.auder.net/variants/img/pieces/doc/current/scripts/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=c9695cb1ffd02c472dd24a2d336c9f3b98bd89da;p=vchess.git Some fixes. TODO: challenge is lost if navigation to variants + back to hall. Ask challenges when connecting --- diff --git a/client/src/components/ChallengeList.vue b/client/src/components/ChallengeList.vue index c7df2dde..bee328f1 100644 --- a/client/src/components/ChallengeList.vue +++ b/client/src/components/ChallengeList.vue @@ -8,9 +8,7 @@ table tr(v-for="c in challenges" @click="$emit('click-challenge',c)") td {{ c.vname }} td {{ c.from.name }} - td(v-if="!!c.to[0]") - span(v-for="pname in c.to") {{ pname }} - td(v-else) {{ c.to.length }} player{{ c.to.length >= 2 ? 's' : '' }} + td {{ c.to }} td {{ c.timeControl }} diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 636eabc3..c7dc588b 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -199,19 +199,17 @@ export default { {target: sid} ))); }; - if (!!to[0]) + if (!!to) { - to.forEach(pname => { - // Challenge with targeted players - const targetSid = this.getSid(pname); - if (!targetSid) - { - if (!!warnDisconnected) - alert("Warning: " + pname + " is not connected"); - } - else - doSend(code, obj, targetSid); - }); + // Challenge with targeted players + const targetSid = this.getSid(to); + if (!targetSid) + { + if (!!warnDisconnected) + alert("Warning: " + pname + " is not connected"); + } + else + doSend(code, obj, targetSid); } else { @@ -403,7 +401,7 @@ export default { const finishAddChallenge = (cid,warnDisconnected) => { chall.id = cid || "c" + getRandString(); // Send challenge to peers (if connected) - this.sendSomethingTo(cto, "challenge", {chall:chall}, !!warnDisconnected); + this.sendSomethingTo(chall.to, "challenge", {chall:chall}, !!warnDisconnected); chall.added = Date.now(); chall.type = ctype; chall.vname = vname;