summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-02-24 21:33:11 +0100
committerTor Andersson <tor@ccxvii.net>2023-02-26 12:53:53 +0100
commit2f28467aed0a1be9e306f2987d5222cb0ad42d6c (patch)
treed235e8481f62a81a894e44b99d362224e1794ef9 /server.js
parent6a4be5ae1b89a4e79a83239f184f394efcabeeba (diff)
downloadserver-2f28467aed0a1be9e306f2987d5222cb0ad42d6c.tar.gz
Only show public games where the owner has joined.
Diffstat (limited to 'server.js')
-rw-r--r--server.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/server.js b/server.js
index 9942cd7..aa42bb0 100644
--- a/server.js
+++ b/server.js
@@ -1126,7 +1126,7 @@ const SQL_INSERT_REMATCH_PLAYERS = SQL("insert into players (game_id, user_id, r
const QUERY_LIST_PUBLIC_GAMES = SQL(`
SELECT * FROM game_view
WHERE is_private=0 AND status = ?
- AND EXISTS ( SELECT 1 FROM players WHERE players.game_id = game_view.game_id )
+ AND EXISTS ( SELECT 1 FROM players WHERE players.game_id = game_view.game_id AND players.user_id = game_view.owner_id )
ORDER BY mtime DESC, ctime DESC
LIMIT ?
`)
@@ -1134,7 +1134,7 @@ const QUERY_LIST_PUBLIC_GAMES = SQL(`
const QUERY_LIST_GAMES_OF_TITLE = SQL(`
SELECT * FROM game_view
WHERE is_private=0 AND title_id=? AND status=?
- AND EXISTS ( SELECT 1 FROM players WHERE players.game_id = game_view.game_id )
+ AND EXISTS ( SELECT 1 FROM players WHERE players.game_id = game_view.game_id AND players.user_id = game_view.owner_id )
ORDER BY mtime DESC, ctime DESC
LIMIT ?
`)