From e2ee70c4e260aa872486d3e44afeebb77f6efb17 Mon Sep 17 00:00:00 2001 From: Ted Johansson Date: Mon, 18 Mar 2024 07:10:30 +0800 Subject: [PATCH] FIX: Amend broken Mailgun API key check (#26206) --- app/services/problem_check/missing_mailgun_api_key.rb | 2 +- spec/services/problem_check/missing_mailgun_api_key_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/problem_check/missing_mailgun_api_key.rb b/app/services/problem_check/missing_mailgun_api_key.rb index d21eb10a15b..7b28fe4d89b 100644 --- a/app/services/problem_check/missing_mailgun_api_key.rb +++ b/app/services/problem_check/missing_mailgun_api_key.rb @@ -5,7 +5,7 @@ class ProblemCheck::MissingMailgunApiKey < ProblemCheck def call 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? problem diff --git a/spec/services/problem_check/missing_mailgun_api_key_spec.rb b/spec/services/problem_check/missing_mailgun_api_key_spec.rb index 1b2ea77ba84..e52625fc323 100644 --- a/spec/services/problem_check/missing_mailgun_api_key_spec.rb +++ b/spec/services/problem_check/missing_mailgun_api_key_spec.rb @@ -6,7 +6,7 @@ RSpec.describe ProblemCheck::MissingMailgunApiKey do describe ".call" do before do 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) end @@ -28,7 +28,7 @@ RSpec.describe ProblemCheck::MissingMailgunApiKey do context "when using Mailgun without an API key" do let(:replies_enabled) { true } - let(:mailgun_address) { "foo" } + let(:mailgun_address) { "smtp.mailgun.org" } let(:api_key) { nil } it do