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
This commit is contained in:
Alec
2024-03-12 22:59:05 -04:00
committed by GitHub
parent 7e71bbb27a
commit 915819bb15

View File

@@ -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;