summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-09-29 01:36:11 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-03 14:01:03 +0200
commit036babec3e9f93822b808a7a62dcf9485ddf3307 (patch)
tree1ca729605a7642ca8262a35e0a62160fa549d146 /public
parent2accdc5d90093bff1e1d7c19d2afc80db603f7bf (diff)
downloadserver-036babec3e9f93822b808a7a62dcf9485ddf3307.tar.gz
Be more robust when deleting accounts.
Leave player assignment to not mess with Elo ratings and tournament data. Reset ctime when game is actually started.
Diffstat (limited to 'public')
-rw-r--r--public/join.js21
1 files changed, 16 insertions, 5 deletions
diff --git a/public/join.js b/public/join.js
index 20a95e7..75e7aca 100644
--- a/public/join.js
+++ b/public/join.js
@@ -275,6 +275,8 @@ function user_link(user_name) {
}
function player_link(player) {
+ if (!player.name)
+ return "null"
let link = user_link(player.name)
if (player.is_invite)
link = "<i>" + link + "</i> ?"
@@ -332,11 +334,18 @@ function create_game_list() {
create_game_list_item(list, "Pace", PACE_TEXT[game.pace])
create_game_list_item(list, "Notice", game.notice)
- if (game.owner_id)
- create_game_list_item(list, "Created", human_date(game.ctime) + " by " + user_link(game.owner_name))
- else
- create_game_list_item(list, "Created", human_date(game.ctime))
+ if (game.status === 0) {
+ if (game.owner_id)
+ create_game_list_item(list, "Created", human_date(game.ctime) + " by " + user_link(game.owner_name))
+ else
+ create_game_list_item(list, "Created", human_date(game.ctime))
+ } else {
+ if (game.owner_id)
+ create_game_list_item(list, "Started", human_date(game.ctime) + " by " + user_link(game.owner_name))
+ else
+ create_game_list_item(list, "Started", human_date(game.ctime))
+ }
create_game_list_item(list, "Moves", game.moves)
@@ -426,7 +435,9 @@ function update() {
}
if (game.status === 0) {
- if (user_id)
+ if (game.is_ready)
+ window.game_enter.textContent = "Waiting to start."
+ else if (user_id)
window.game_enter.textContent = "Waiting for players to join."
else
window.game_enter.innerHTML = `<a href="/login">Login</a> or <a href="/signup">sign up</a> to join.`