Skip to content

Commit

Permalink
Fix bug where we incorrectly added a user as a player instead of a sp…
Browse files Browse the repository at this point in the history
…ectator (#189)

* fix bug with failing to add as spectator for in-progress game

* refactor fix

* revert to previous fix
  • Loading branch information
AlecM33 committed Mar 13, 2024
1 parent 7e71bbb commit 915819b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server/modules/singletons/GameManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.' });

Check warning on line 193 in server/modules/singletons/GameManager.js

View workflow job for this annotation

GitHub Actions / build (14.x)

Expected the Promise rejection reason to be an Error
} 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;
Expand Down

0 comments on commit 915819b

Please sign in to comment.