Fix voting

This commit is contained in:
Chris Blanchard 2016-03-19 13:59:48 +00:00
parent 1363826137
commit ad55f5fe6d
3 changed files with 10 additions and 6 deletions

View file

@ -9,6 +9,7 @@ const hiveUrl = helper.hiveUrl;
const SelectPlayerButton = React.createClass({ const SelectPlayerButton = React.createClass({
propTypes: { propTypes: {
socket: React.PropTypes.object.isRequired, socket: React.PropTypes.object.isRequired,
gather: React.PropTypes.object.isRequired,
gatherer: React.PropTypes.object.isRequired gatherer: React.PropTypes.object.isRequired
}, },
@ -368,13 +369,13 @@ const GatherActions = React.createClass({
<div> <div>
<div className="text-right"> <div className="text-right">
<ul className="list-inline no-bottom"> <ul className="list-inline no-bottom">
<li>
{regatherButton}
</li>
<li> <li>
<JoinGatherButton gather={gather} thisGatherer={thisGatherer} <JoinGatherButton gather={gather} thisGatherer={thisGatherer}
user={user} socket={socket} /> user={user} socket={socket} />
</li> </li>
<li>
{regatherButton}
</li>
</ul> </ul>
</div> </div>
</div> </div>
@ -836,7 +837,9 @@ const GathererListItem = React.createClass({
thisGatherer.team === gather.pickingTurn) { thisGatherer.team === gather.pickingTurn) {
action = ( action = (
<span> <span>
<SelectPlayerButton gatherer={gatherer} socket={socket}/> <SelectPlayerButton gatherer={gatherer}
gather={gather}
socket={socket}/>
</span> </span>
); );
} else { } else {

View file

@ -362,6 +362,7 @@ const GatherPage = React.createClass({
onGatherSelected(gatherName) { onGatherSelected(gatherName) {
let gather = this.state.gatherPool[gatherName]; let gather = this.state.gatherPool[gatherName];
if (gather === undefined) return; if (gather === undefined) return;
this.updateTitle();
this.setState({ this.setState({
currentGather: gather.type currentGather: gather.type
}); });

View file

@ -171,7 +171,7 @@ module.exports = function (namespace) {
let playerId = data.player; let playerId = data.player;
// Check team & leader // Check team & leader
let gatherer = gatherPool.getGatherer(socket._user); let gatherer = gather.getGatherer(socket._user);
// Cancel if not gatherer or leader // Cancel if not gatherer or leader
if (gatherer === null || gatherer.leader === false) { if (gatherer === null || gatherer.leader === false) {
@ -179,7 +179,7 @@ module.exports = function (namespace) {
} }
// Cancel if id belongs to a leader // Cancel if id belongs to a leader
let selectedPlayer = gatherPool.getGatherer({id: playerId}); let selectedPlayer = gather.getGatherer({id: playerId});
if (selectedPlayer === null || selectedPlayer.leader) { if (selectedPlayer === null || selectedPlayer.leader) {
return null; return null;