mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-11-17 22:42:31 +08:00
Fix IMAP/SMTP port dropdowns in the configuration screen “sticking”
This commit is contained in:
parent
4509789e32
commit
33cf7b5b67
3 changed files with 30 additions and 21 deletions
|
|
@ -63,7 +63,7 @@ const CreatePageForForm = FormComponent => {
|
|||
return errorFieldNames.length === 0 && populated;
|
||||
}
|
||||
|
||||
onFieldChange = event => {
|
||||
onFieldChange = (event, { afterSetState } = {}) => {
|
||||
const next = this.state.account.clone();
|
||||
|
||||
let val = event.target.value;
|
||||
|
|
@ -83,13 +83,16 @@ const CreatePageForForm = FormComponent => {
|
|||
|
||||
const { errorFieldNames, errorMessage, populated } = FormComponent.validateAccount(next);
|
||||
|
||||
this.setState({
|
||||
account: next,
|
||||
errorFieldNames,
|
||||
errorMessage,
|
||||
populated,
|
||||
errorStatusCode: null,
|
||||
});
|
||||
this.setState(
|
||||
{
|
||||
account: next,
|
||||
errorFieldNames,
|
||||
errorMessage,
|
||||
populated,
|
||||
errorStatusCode: null,
|
||||
},
|
||||
afterSetState
|
||||
);
|
||||
};
|
||||
|
||||
onSubmit = () => {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ function idForAccount(emailAddress, connectionSettings) {
|
|||
|
||||
function mxRecordsForDomain(domain) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// timeout here is annoyingly long - 30s?
|
||||
dns.resolveMx(domain, (err, addresses) => {
|
||||
if (err) {
|
||||
resolve([]);
|
||||
|
|
|
|||
|
|
@ -69,19 +69,24 @@ class AccountIMAPSettingsForm extends React.Component {
|
|||
// the standard for that port. Lots of people don't update that field and
|
||||
// are getting confused.
|
||||
const onPortChange = event => {
|
||||
onFieldChange(event);
|
||||
if (event.target.value / 1 === 143 && settings.imap_security !== 'none') {
|
||||
onFieldChange({ target: { value: 'none', id: 'settings.imap_security' } });
|
||||
}
|
||||
if (event.target.value / 1 === 993 && settings.imap_security !== 'SSL / TLS') {
|
||||
onFieldChange({ target: { value: 'SSL / TLS', id: 'settings.imap_security' } });
|
||||
}
|
||||
if (event.target.value / 1 === 25 && settings.smtp_security !== 'none') {
|
||||
onFieldChange({ target: { value: 'none', id: 'settings.smtp_security' } });
|
||||
}
|
||||
if (event.target.value / 1 === 587 && settings.smtp_security !== 'STARTTLS') {
|
||||
onFieldChange({ target: { value: 'STARTTLS', id: 'settings.smtp_security' } });
|
||||
}
|
||||
const port = event.target.value / 1;
|
||||
|
||||
onFieldChange(event, {
|
||||
afterSetState: () => {
|
||||
if (port === 143 && settings.imap_security !== 'none') {
|
||||
onFieldChange({ target: { value: 'none', id: 'settings.imap_security' } });
|
||||
}
|
||||
if (port === 993 && settings.imap_security !== 'SSL / TLS') {
|
||||
onFieldChange({ target: { value: 'SSL / TLS', id: 'settings.imap_security' } });
|
||||
}
|
||||
if (port === 25 && settings.smtp_security !== 'none') {
|
||||
onFieldChange({ target: { value: 'none', id: 'settings.smtp_security' } });
|
||||
}
|
||||
if (port === 587 && settings.smtp_security !== 'STARTTLS') {
|
||||
onFieldChange({ target: { value: 'STARTTLS', id: 'settings.smtp_security' } });
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue