Fixes #3921 - Can not chose SSL yes and port 143 when setting up mail account.

This commit is contained in:
Rolf Schmidt 2022-02-08 10:37:53 +01:00
parent 7703c3efc6
commit 8fcb3fb52e
3 changed files with 18 additions and 31 deletions

View file

@ -428,20 +428,7 @@ class ChannelEmailAccountWizard extends App.ControllerWizardModal
ui.hide('options::folder')
ui.hide('options::keep_on_server')
handlePort = (params, attribute, attributes, classname, form, ui) ->
return if !params
return if !params.options
currentPort = @$('[name="options::port"]').val()
if params.options.ssl is true
if !currentPort || currentPort is '143'
@$('[name="options::port"]').val('993')
return
if params.options.ssl is false
if !currentPort || currentPort is '993'
@$('[name="options::port"]').val('143')
return
new App.ControllerForm(
form = new App.ControllerForm(
el: @$('.base-inbound-settings'),
model:
configure_attributes: configureAttributesInbound
@ -449,10 +436,16 @@ class ChannelEmailAccountWizard extends App.ControllerWizardModal
params: @account.inbound
handlers: [
showHideFolder,
handlePort,
]
)
form.el.find("select[name='options::ssl']").off('change').on('change', (e) ->
if $(e.target).val() is 'true'
form.el.find("[name='options::port']").val('993')
else
form.el.find("[name='options::port']").val('143')
)
toggleOutboundAdapter: =>
# fill user / password based on intro info

View file

@ -91,20 +91,7 @@ class GettingStartedChannelEmail extends App.ControllerWizardFullScreen
ui.hide('options::folder')
ui.hide('options::keep_on_server')
handlePort = (params, attribute, attributes, classname, form, ui) ->
return if !params
return if !params.options
currentPort = @$('.base-inbound-settings [name="options::port"]').val()
if params.options.ssl is true
if !currentPort
@$('.base-inbound-settings [name="options::port"]').val('993')
return
if params.options.ssl is false
if !currentPort || currentPort is '993'
@$('.base-inbound-settings [name="options::port"]').val('143')
return
new App.ControllerForm(
form = new App.ControllerForm(
el: @$('.base-inbound-settings')
model:
configure_attributes: configureAttributesInbound
@ -112,10 +99,16 @@ class GettingStartedChannelEmail extends App.ControllerWizardFullScreen
params: @account.inbound
handlers: [
showHideFolder,
handlePort,
]
)
form.el.find("select[name='options::ssl']").off('change').on('change', (e) ->
if $(e.target).val() is 'true'
form.el.find("[name='options::port']").val('993')
else
form.el.find("[name='options::port']").val('143')
)
toggleOutboundAdapter: =>
# fill user / password based on intro info

View file

@ -54,8 +54,9 @@ RSpec.describe 'Manage > Channels > Email', type: :system do
expect(find('input[name="options::port"]').value).to eq('143')
port = '4242'
fill_in 'options::port', with: port
field.click
expect(find('input[name="options::port"]').value).to eq(port)
option_yes.select_option
fill_in 'options::folder', with: 'testabc'
expect(find('input[name="options::port"]').value).to eq(port)
click '.js-close'
end