mirror of
https://github.com/mastodon/mastodon.git
synced 2025-11-27 10:00:50 +00:00
Fix SMTP configuration with mail 2.9.0 (#36646)
Some checks are pending
Bundler Audit / security (push) Waiting to run
Check i18n / check-i18n (push) Waiting to run
Chromatic / Run Chromatic (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Haml Linting / lint (push) Waiting to run
JavaScript Linting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
JavaScript Testing / test (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / ImageMagick tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / ImageMagick tests (3.2) (push) Blocked by required conditions
Ruby Testing / ImageMagick tests (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Some checks are pending
Bundler Audit / security (push) Waiting to run
Check i18n / check-i18n (push) Waiting to run
Chromatic / Run Chromatic (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Haml Linting / lint (push) Waiting to run
JavaScript Linting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
JavaScript Testing / test (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / ImageMagick tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / ImageMagick tests (3.2) (push) Blocked by required conditions
Ruby Testing / ImageMagick tests (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
This commit is contained in:
parent
e5e9f8da93
commit
762e87b121
|
|
@ -8,25 +8,23 @@ module Mastodon
|
|||
# `config/email.yml`) into the format that `ActionMailer` understands
|
||||
def convert_smtp_settings(config)
|
||||
enable_starttls = nil
|
||||
enable_starttls_auto = nil
|
||||
|
||||
case config[:enable_starttls]
|
||||
when 'always'
|
||||
enable_starttls = true
|
||||
when 'never'
|
||||
enable_starttls = :always
|
||||
when 'never', 'false'
|
||||
enable_starttls = false
|
||||
when 'auto'
|
||||
enable_starttls_auto = true
|
||||
enable_starttls = :auto
|
||||
else
|
||||
enable_starttls_auto = config[:enable_starttls_auto] != 'false'
|
||||
enable_starttls = config[:enable_starttls_auto] ? :auto : false unless config[:tls] || config[:ssl]
|
||||
end
|
||||
|
||||
authentication = config[:authentication] == 'none' ? nil : (config[:authentication] || 'plain')
|
||||
|
||||
config.merge(
|
||||
config.without(:enable_starttls_auto).merge(
|
||||
authentication:,
|
||||
enable_starttls:,
|
||||
enable_starttls_auto:
|
||||
enable_starttls:
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,8 +21,9 @@ RSpec.describe Mastodon::EmailConfigurationHelper do
|
|||
base_configuration.merge({ enable_starttls: 'always' })
|
||||
end
|
||||
|
||||
it 'converts this to `true`' do
|
||||
expect(converted_settings[:enable_starttls]).to be true
|
||||
it 'converts this to `:always`' do
|
||||
expect(converted_settings[:enable_starttls]).to eq :always
|
||||
expect(converted_settings[:enable_starttls_auto]).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -33,6 +34,7 @@ RSpec.describe Mastodon::EmailConfigurationHelper do
|
|||
|
||||
it 'converts this to `false`' do
|
||||
expect(converted_settings[:enable_starttls]).to be false
|
||||
expect(converted_settings[:enable_starttls_auto]).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -41,28 +43,43 @@ RSpec.describe Mastodon::EmailConfigurationHelper do
|
|||
base_configuration.merge({ enable_starttls: 'auto' })
|
||||
end
|
||||
|
||||
it 'sets `enable_starttls_auto` instead' do
|
||||
expect(converted_settings[:enable_starttls]).to be_nil
|
||||
expect(converted_settings[:enable_starttls_auto]).to be true
|
||||
it 'sets `enable_starttls` to `:auto`' do
|
||||
expect(converted_settings[:enable_starttls]).to eq :auto
|
||||
expect(converted_settings[:enable_starttls_auto]).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when `enable_starttls` is unset' do
|
||||
context 'when `enable_starttls_auto` is unset' do
|
||||
let(:configuration) { base_configuration }
|
||||
context 'when `enable_starttls_auto` is true' do
|
||||
let(:configuration) do
|
||||
base_configuration.merge({ enable_starttls_auto: true })
|
||||
end
|
||||
|
||||
it 'sets `enable_starttls_auto` to `true`' do
|
||||
expect(converted_settings[:enable_starttls_auto]).to be true
|
||||
it 'sets `enable_starttls` to `:auto`' do
|
||||
expect(converted_settings[:enable_starttls]).to eq :auto
|
||||
expect(converted_settings[:enable_starttls_auto]).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when `enable_starttls_auto` is set to "false"' do
|
||||
context 'when `tls` is set to true' do
|
||||
let(:configuration) do
|
||||
base_configuration.merge({ enable_starttls_auto: 'false' })
|
||||
base_configuration.merge({ tls: true })
|
||||
end
|
||||
|
||||
it 'sets `enable_starttls_auto` to `false`' do
|
||||
expect(converted_settings[:enable_starttls_auto]).to be false
|
||||
it 'sets `enable_starttls` to `nil`' do
|
||||
expect(converted_settings[:enable_starttls]).to be_nil
|
||||
expect(converted_settings[:enable_starttls_auto]).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when `enable_starttls_auto` is set to false' do
|
||||
let(:configuration) do
|
||||
base_configuration.merge({ enable_starttls_auto: false })
|
||||
end
|
||||
|
||||
it 'sets `enable_starttls` to `false`' do
|
||||
expect(converted_settings[:enable_starttls]).to be false
|
||||
expect(converted_settings[:enable_starttls_auto]).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ RSpec.describe UserMailer do
|
|||
address: 'localhost',
|
||||
port: 25,
|
||||
authentication: 'none',
|
||||
enable_starttls_auto: true,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
@ -44,8 +45,7 @@ RSpec.describe UserMailer do
|
|||
address: 'localhost',
|
||||
port: 25,
|
||||
authentication: nil,
|
||||
enable_starttls: nil,
|
||||
enable_starttls_auto: true,
|
||||
enable_starttls: :auto,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user