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 committed by Dominik Klein
parent 52ced8dd40
commit 3d8398769a
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::folder')
ui.hide('options::keep_on_server') ui.hide('options::keep_on_server')
handlePort = (params, attribute, attributes, classname, form, ui) -> form = new App.ControllerForm(
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(
el: @$('.base-inbound-settings'), el: @$('.base-inbound-settings'),
model: model:
configure_attributes: configureAttributesInbound configure_attributes: configureAttributesInbound
@ -449,10 +436,16 @@ class ChannelEmailAccountWizard extends App.ControllerWizardModal
params: @account.inbound params: @account.inbound
handlers: [ handlers: [
showHideFolder, 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: => toggleOutboundAdapter: =>
# fill user / password based on intro info # 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::folder')
ui.hide('options::keep_on_server') ui.hide('options::keep_on_server')
handlePort = (params, attribute, attributes, classname, form, ui) -> form = new App.ControllerForm(
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(
el: @$('.base-inbound-settings') el: @$('.base-inbound-settings')
model: model:
configure_attributes: configureAttributesInbound configure_attributes: configureAttributesInbound
@ -112,10 +99,16 @@ class GettingStartedChannelEmail extends App.ControllerWizardFullScreen
params: @account.inbound params: @account.inbound
handlers: [ handlers: [
showHideFolder, 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: => toggleOutboundAdapter: =>
# fill user / password based on intro info # fill user / password based on intro info

View file

@ -161,8 +161,9 @@ RSpec.describe 'Manage > Channels > Email', type: :system do
expect(find('input[name="options::port"]').value).to eq('143') expect(find('input[name="options::port"]').value).to eq('143')
port = '4242' port = '4242'
fill_in 'options::port', with: port fill_in 'options::port', with: port
field.click
expect(find('input[name="options::port"]').value).to eq(port) 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) expect(find('input[name="options::port"]').value).to eq(port)
click '.js-close' click '.js-close'
end end