fix(toggle): Will always turn off read receipt config on error

This commit is contained in:
Evan Morikawa 2016-02-24 18:04:42 -08:00
parent db5c822ccf
commit 267fdc1760

View file

@ -80,7 +80,7 @@ export default class MetadataComposerToggleButton extends React.Component {
.catch((error) => {
this.setState({enabled: false});
if (this._shouldStickFalseOnError(error)) {
if (this.props.stickyToggle) {
NylasEnv.config.set(this._configKey(), false)
}
@ -100,11 +100,6 @@ export default class MetadataComposerToggleButton extends React.Component {
});
}
_shouldStickFalseOnError(error) {
return this.props.stickyToggle && (error instanceof APIError) &&
(NylasAPI.PermanentErrorCodes.indexOf(error.statusCode) === -1);
}
_onClick = () => {
// Toggle.
if (this.state.pending) { return; }