X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=ee8d53e5a54f59c06ff97aa6ac738d7515eee25e;hb=aef58d08d7c453f7ae7947e718c3bd6f092f02f2;hp=fd4bd2da90c99220e84ab78916785ec256308360;hpb=077ba3446c4ea3c6553c325fc8d16a96b7a9ff4f;p=vchess.git diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index fd4bd2da..ee8d53e5 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -186,13 +186,13 @@ main GameList( v-show="gdisplay=='live'" :games="filterGames('live')" - :showBoth="true" + :show-both="true" @show-game="showGame" ) div(v-show="gdisplay=='corr'") GameList( :games="filterGames('corr')" - :showBoth="true" + :show-both="true" @show-game="showGame" ) button#loadMoreBtn( @@ -681,12 +681,19 @@ export default { this.$delete(this.people, data.from[0]); else this.$forceUpdate(); //TODO: shouldn't be required if (data.code == "disconnect") { - // Remove the live challenges sent by this player: - ArrayFun.remove( - this.challenges, - c => c.type == "live" && c.from.sid == data.from[0], - "all" - ); + // Remove the live challenges sent by this player, if + // he isn't connected on another tab: + if ( + !this.people[data.from[0]] || + Object.values(this.people[data.from[0]].tmpIds) + .every(v => v.page != "/") + ) { + ArrayFun.remove( + this.challenges, + c => c.type == "live" && c.from.sid == data.from[0], + "all" + ); + } } else { // Remove the matching live game if now unreachable const gid = data.page.match(/[a-zA-Z0-9]+$/)[0]; @@ -1182,10 +1189,13 @@ export default { // NOTE: when launching game, the challenge is already being deleted launchGame: function(c) { // White player index 0, black player index 1: - const players = + let players = !!c.mycolor ? (c.mycolor == "w" ? [c.seat, c.from] : [c.from, c.seat]) : shuffle([c.from, c.seat]); + players.forEach(p => { + if (!!p["tmpIds"]) delete p["tmpIds"]; + }); // These game informations will be shared let gameInfo = { id: getRandString(),