From 915819bb15e14cfe909ce5447f0c2d7cab638638 Mon Sep 17 00:00:00 2001 From: Alec Date: Tue, 12 Mar 2024 22:59:05 -0400 Subject: [PATCH] Fix bug where we incorrectly added a user as a player instead of a spectator (#189) * fix bug with failing to add as spectator for in-progress game * refactor fix * revert to previous fix --- server/modules/singletons/GameManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/modules/singletons/GameManager.js b/server/modules/singletons/GameManager.js index 494db51..3206dd0 100644 --- a/server/modules/singletons/GameManager.js +++ b/server/modules/singletons/GameManager.js @@ -191,7 +191,7 @@ class GameManager { && game.people.filter(person => person.userType === USER_TYPES.SPECTATOR).length === PRIMITIVES.MAX_SPECTATORS ) { return Promise.reject({ status: 400, reason: 'There are too many people already spectating.' }); - } else if (joinAsSpectator || this.isGameStartable(game)) { + } else if (joinAsSpectator || this.isGameStartable(game) || game.status === STATUS.IN_PROGRESS) { return await addSpectator(game, name, this.logger, this.namespace, this.eventManager, this.instanceId, this.refreshGame); } let moderator, newPlayer;