FIX: Amend broken Mailgun API key check (#26206)

This commit is contained in:
Ted Johansson 2024-03-18 07:10:30 +08:00 committed by GitHub
parent 78bafb331a
commit e2ee70c4e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ class ProblemCheck::MissingMailgunApiKey < ProblemCheck
def call def call
return no_problem if !SiteSetting.reply_by_email_enabled return no_problem if !SiteSetting.reply_by_email_enabled
return no_problem if !ActionMailer::Base.smtp_settings.dig(:address, "smtp.mailgun.org") return no_problem if ActionMailer::Base.smtp_settings[:address] != "smtp.mailgun.org"
return no_problem if SiteSetting.mailgun_api_key.present? return no_problem if SiteSetting.mailgun_api_key.present?
problem problem

View File

@ -6,7 +6,7 @@ RSpec.describe ProblemCheck::MissingMailgunApiKey do
describe ".call" do describe ".call" do
before do before do
SiteSetting.stubs(reply_by_email_enabled: replies_enabled) SiteSetting.stubs(reply_by_email_enabled: replies_enabled)
ActionMailer::Base.smtp_settings.stubs(dig: mailgun_address) ActionMailer::Base.stubs(smtp_settings: { address: mailgun_address })
SiteSetting.stubs(mailgun_api_key: api_key) SiteSetting.stubs(mailgun_api_key: api_key)
end end
@ -28,7 +28,7 @@ RSpec.describe ProblemCheck::MissingMailgunApiKey do
context "when using Mailgun without an API key" do context "when using Mailgun without an API key" do
let(:replies_enabled) { true } let(:replies_enabled) { true }
let(:mailgun_address) { "foo" } let(:mailgun_address) { "smtp.mailgun.org" }
let(:api_key) { nil } let(:api_key) { nil }
it do it do