Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[client-app] Replace smtp/imap port dropdown with input field #3640

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,52 +56,6 @@ class AccountIMAPSettingsForm extends React.Component {
this.props.onConnect();
}

renderPortDropdown(protocol) {
if (!["imap", "smtp"].includes(protocol)) {
throw new Error(`Can't render port dropdown for protocol '${protocol}'`);
}
const {accountInfo, submitting, onFieldKeyPress, onFieldChange} = this.props;

if (protocol === "imap") {
return (
<span>
<label htmlFor="imap_port">Port:</label>
<select
id="imap_port"
tabIndex={0}
value={accountInfo.imap_port}
disabled={submitting}
onKeyPress={onFieldKeyPress}
onChange={onFieldChange}
>
<option value="143" key="143">143</option>
<option value="993" key="993">993</option>
</select>
</span>
)
}
if (protocol === "smtp") {
return (
<span>
<label htmlFor="smtp_port">Port:</label>
<select
id="smtp_port"
tabIndex={0}
value={accountInfo.smtp_port}
disabled={submitting}
onKeyPress={onFieldKeyPress}
onChange={onFieldChange}
>
<option value="25" key="25">25</option>
<option value="465" key="465">465</option>
<option value="587" key="587">587</option>
</select>
</span>
)
}
return "";
}

renderSecurityDropdown(protocol) {
const {accountInfo, submitting, onFieldKeyPress, onFieldChange} = this.props;

Expand Down Expand Up @@ -142,7 +96,7 @@ class AccountIMAPSettingsForm extends React.Component {
<div>
<FormField field={`${type}_host`} title={"Server"} {...this.props} />
<div style={{textAlign: 'left'}}>
{this.renderPortDropdown(type)}
<FormField field={`${type}_port`} title={"Port"} {...this.props} />
{this.renderSecurityDropdown(type)}
</div>
<FormField field={`${type}_username`} title={"Username"} {...this.props} />
Expand Down