More PR feedback

Unmounted guards, extra semicolon, return early to lose indent
level, add keys.
pull/21833/head
David Baker 2017-03-22 16:41:08 +00:00
parent 6b78440466
commit b58d8bffe1
1 changed files with 35 additions and 31 deletions

View File

@ -86,8 +86,9 @@ export default WithMatrixClient(React.createClass({
description: msg,
});
}).finally(() => {
if (this._unmounted) return;
this.setState({msisdn_add_pending: false});
}).done();;
}).done();
this._addMsisdnInput.blur();
this.setState({msisdn_add_pending: true});
},
@ -96,7 +97,7 @@ export default WithMatrixClient(React.createClass({
if (this._unmounted) return;
const TextInputDialog = sdk.getComponent("dialogs.TextInputDialog");
let msgElements = [
<div>A text message has been sent to +{msisdn}.
<div key="_static" >A text message has been sent to +{msisdn}.
Please enter the verification code it contains</div>
];
if (err) {
@ -104,7 +105,7 @@ export default WithMatrixClient(React.createClass({
if (err.errcode == 'M_THREEPID_AUTH_FAILED') {
msg = "Incorrect verification code";
}
msgElements.push(<div className="error">{msg}</div>);
msgElements.push(<div key="_error" className="error">{msg}</div>);
}
Modal.createDialog(TextInputDialog, {
title: "Enter Code",
@ -123,6 +124,7 @@ export default WithMatrixClient(React.createClass({
}).catch((err) => {
this._promptForMsisdnVerificationCode(msisdn, err);
}).finally(() => {
if (this._unmounted) return;
this.setState({msisdn_add_pending: false});
}).done();
}
@ -133,7 +135,10 @@ export default WithMatrixClient(React.createClass({
const Loader = sdk.getComponent("elements.Spinner");
if (this.state.msisdn_add_pending) {
return <Loader />;
} else if (!this.props.matrixClient.isGuest()) {
} else if (this.props.matrixClient.isGuest()) {
return null;
}
const CountryDropdown = sdk.getComponent('views.login.CountryDropdown');
// XXX: This CSS relies on the CSS surrounding it in UserSettings as its in
// a tabular format to align the submit buttons
@ -162,5 +167,4 @@ export default WithMatrixClient(React.createClass({
</form>
);
}
}
}))