Skip to content

Commit

Permalink
Fixed logic check for joining the game session by DMs (#158)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivellios authored Feb 5, 2023
1 parent 7cc57b4 commit 67b02a6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/pages/GameDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,16 @@ class GameDetail extends Component {
};

userIsRunning = () => {
return this.state.game.dm.id === this.props.portalStore.currentUser.profileID;
return this.state.game.dm && this.state.game.dm.id === this.props.portalStore.currentUser.profileID;
}

canSignUp = () => {
const players = this.state.game.players.map(player => player.profile.id);
const player = this.props.portalStore.currentUser.profileID;
const usersGameSlot = this.state.game.dm && this.userIsRunning;
const future = this.state.game.ended === false;
const emptySpot = this.freeSpots() > 0;
const isDM = this.state.game.dm;
return isDM && future && players.indexOf(player) === -1 && !usersGameSlot && emptySpot;
return isDM && future && players.indexOf(player) === -1 && !this.userIsRunning() && emptySpot;
};

hasCharacters = () => {
Expand Down

0 comments on commit 67b02a6

Please sign in to comment.