mirror of
https://github.com/AlecM33/Werewolf.git
synced 2025-12-26 07:47:50 +01:00
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:
@@ -191,7 +191,7 @@ class GameManager {
|
|||||||
&& game.people.filter(person => person.userType === USER_TYPES.SPECTATOR).length === PRIMITIVES.MAX_SPECTATORS
|
&& 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.' });
|
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);
|
return await addSpectator(game, name, this.logger, this.namespace, this.eventManager, this.instanceId, this.refreshGame);
|
||||||
}
|
}
|
||||||
let moderator, newPlayer;
|
let moderator, newPlayer;
|
||||||
|
|||||||
Reference in New Issue
Block a user