From 2941cfca4982a10ee68d2dc0b61c3f7ba8c9147b Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 11 Jul 2026 23:13:30 +0200 Subject: [PATCH] Fix game route dumping players into the terminal for non-PLAYING sessions GameController::index() only special-cased READY; every other status (including a freshly-created session still waiting for players, and even an already WON/LOST one) fell straight through to rendering the live game terminal - which is broken there since screens/rights/pwd are never initialized before startSession() flips CREATED -> READY. The dashboard's "Enter Game" button links to this route regardless of status, so any player clicking it on a CREATED session hit this directly. Now CREATED redirects back to the dashboard with an explanatory flash, and WON/LOST redirect to their respective pages instead of re-rendering a dead terminal. --- src/Game/Controller/GameController.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Game/Controller/GameController.php b/src/Game/Controller/GameController.php index a285313..0268cef 100644 --- a/src/Game/Controller/GameController.php +++ b/src/Game/Controller/GameController.php @@ -134,6 +134,19 @@ final class GameController extends AbstractController // Lazily pick up readiness changes from other players since our last request $dashboardService->checkAllPlayersReady($session); + if ($session->getStatus() === SessionStatus::CREATED) { + $this->addFlash('info', 'This session is still waiting for more players to join.'); + return $this->redirectToRoute('game_dashboard'); + } + + if ($session->getStatus() === SessionStatus::WON) { + return $this->redirectToRoute('game_won', ['session' => $session->getId()]); + } + + if ($session->getStatus() === SessionStatus::LOST) { + return $this->redirectToRoute('game_lost', ['session' => $session->getId()]); + } + if ($session->getStatus() === SessionStatus::READY) { $isReady = false; if ($player) {