Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
Fix voting
Browse files Browse the repository at this point in the history
  • Loading branch information
cblanc committed Mar 19, 2016
1 parent c2e37d5 commit 150e6ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
11 changes: 7 additions & 4 deletions app/javascripts/components/gather.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const hiveUrl = helper.hiveUrl;
const SelectPlayerButton = React.createClass({
propTypes: {
socket: React.PropTypes.object.isRequired,
gather: React.PropTypes.object.isRequired,
gatherer: React.PropTypes.object.isRequired
},

Expand Down Expand Up @@ -368,13 +369,13 @@ const GatherActions = React.createClass({
<div>
<div className="text-right">
<ul className="list-inline no-bottom">
<li>
{regatherButton}
</li>
<li>
<JoinGatherButton gather={gather} thisGatherer={thisGatherer}
user={user} socket={socket} />
</li>
<li>
{regatherButton}
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -836,7 +837,9 @@ const GathererListItem = React.createClass({
thisGatherer.team === gather.pickingTurn) {
action = (
<span>
<SelectPlayerButton gatherer={gatherer} socket={socket}/>
<SelectPlayerButton gatherer={gatherer}
gather={gather}
socket={socket}/>
</span>
);
} else {
Expand Down
1 change: 1 addition & 0 deletions app/javascripts/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ const GatherPage = React.createClass({
onGatherSelected(gatherName) {
let gather = this.state.gatherPool[gatherName];
if (gather === undefined) return;
this.updateTitle();
this.setState({
currentGather: gather.type
});
Expand Down
4 changes: 2 additions & 2 deletions lib/gather/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@ module.exports = function (namespace) {

let playerId = data.player;
// Check team & leader
let gatherer = gatherPool.getGatherer(socket._user);
let gatherer = gather.getGatherer(socket._user);

// Cancel if not gatherer or leader
if (gatherer === null || gatherer.leader === false) {
return null;
}

// Cancel if id belongs to a leader
let selectedPlayer = gatherPool.getGatherer({id: playerId});
let selectedPlayer = gather.getGatherer({id: playerId});

if (selectedPlayer === null || selectedPlayer.leader) {
return null;
Expand Down

0 comments on commit 150e6ce

Please sign in to comment.