+ if (
+ // My game ?
+ game.players.some(p =>
+ p.sid == this.st.user.sid || p.id == this.st.user.id
+ )
+ ) {
+ const message =
+ game.score != "*"
+ ? "Remove game?"
+ : "Abort and remove game?";
+ if (confirm(this.st.tr[message])) {
+ const afterDelete = () => {
+ if (game.score == "*" && game.type != "import")
+ this.$emit("abortgame", game);
+ this.$set(this.deleted, game.id, true);
+ };
+ if (game.type == "live")
+ // Effectively remove game:
+ GameStorage.remove(game.id, afterDelete);
+ else if (game.type == "import")
+ ImportgameStorage.remove(game.id, afterDelete);
+ else {
+ const mySide =
+ game.players[0].id == this.st.user.id
+ ? "White"
+ : "Black";
+ game["deletedBy" + mySide] = true;
+ // Mark the game for deletion on server
+ // If both people mark it, it is deleted
+ ajax(
+ "/games",
+ "PUT",
+ {
+ data: {
+ gid: game.id,
+ newObj: { removeFlag: true }
+ },
+ success: afterDelete
+ }
+ );
+ }
+ }