Fixed EmailAuthenticationSettings mutating the stored config (#4743)

This commit is contained in:
Harrison Healey
2016-12-09 07:54:12 -05:00
committed by Joram Wilander
parent d7ee335106
commit e068c1d58e
2 changed files with 8 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ export default class EmailConnectionTestButton extends React.Component {
static get propTypes() {
return {
config: React.PropTypes.object.isRequired,
getConfigFromState: React.PropTypes.func.isRequired,
disabled: React.PropTypes.bool.isRequired
};
}
@@ -37,8 +38,11 @@ export default class EmailConnectionTestButton extends React.Component {
fail: null
});
const config = JSON.parse(JSON.stringify(this.props.config));
this.props.getConfigFromState(config);
Client.testEmail(
this.props.config,
config,
() => {
this.setState({
testing: false,
@@ -120,4 +124,4 @@ export default class EmailConnectionTestButton extends React.Component {
</div>
);
}
}
}

View File

@@ -272,7 +272,8 @@ export default class EmailSettings extends AdminSettings {
disabled={!this.state.sendEmailNotifications}
/>
<EmailConnectionTest
config={this.getConfigFromState(this.props.config)}
config={this.props.config}
getConfigFromState={this.getConfigFromState}
disabled={!this.state.sendEmailNotifications}
/>
<BooleanSetting