Skip to content

Commit

Permalink
Merge pull request #76 from empiricaly/playerIdParam-no-consent
Browse files Browse the repository at this point in the history
Fix bug where playerIdParam is ignored if ConsentComponent is not absent.
  • Loading branch information
npaton committed Oct 2, 2018
2 parents e1c7c0f + 47e5832 commit ccf9faf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions imports/core/ui/components/NewPlayer.jsx
Expand Up @@ -9,7 +9,6 @@ import Centered from "./Centered.jsx";

const { ConsentComponent } = config;
import Loading from "./Loading.jsx";
const { playerIdParam } = Meteor.settings.public;

export default class NewPlayer extends React.Component {
state = { id: "", consented: false };
Expand All @@ -25,6 +24,11 @@ export default class NewPlayer extends React.Component {
}
}

componentWillMount() {
if (!ConsentComponent) {
this.playerFromIdParam();
}
}
componentWillUnmount() {
if (this.timeout) {
clearTimeout(this.timeout);
Expand Down Expand Up @@ -52,7 +56,10 @@ export default class NewPlayer extends React.Component {

handleConsent = () => {
this.setState({ consented: true });
this.playerFromIdParam();
};

playerFromIdParam() {
const { playerIdParam } = Meteor.settings.public;

if (playerIdParam) {
Expand All @@ -71,7 +78,7 @@ export default class NewPlayer extends React.Component {
});
}
}
};
}

render() {
const { id, consented, attemptingAutoLogin } = this.state;
Expand Down

0 comments on commit ccf9faf

Please sign in to comment.