Fixed EmailAuthenticationSettings mutating the stored config (#4743)

Этот коммит содержится в:
Harrison Healey
2016-12-09 07:54:12 -05:00
коммит произвёл Joram Wilander
родитель d7ee335106
Коммит e068c1d58e
2 изменённых файлов: 8 добавлений и 3 удалений

Просмотреть файл

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

Просмотреть файл

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