mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Improve email testing admin tool. (#6308)
This commit is contained in:
committed by
Régis Hanol
parent
c1a5a7504e
commit
72ffabf619
@@ -11,7 +11,13 @@ class Admin::EmailController < Admin::AdminController
|
||||
params.require(:email_address)
|
||||
begin
|
||||
Jobs::TestEmail.new.execute(to_address: params[:email_address])
|
||||
render body: nil
|
||||
if SiteSetting.disable_emails == "yes"
|
||||
render json: { sent_test_email_message: I18n.t("admin.email.sent_test_disabled") }
|
||||
elsif SiteSetting.disable_emails == "non-staff" && !User.find_by_email(params[:email_address])&.staff?
|
||||
render json: { sent_test_email_message: I18n.t("admin.email.sent_test_disabled_for_non_staff") }
|
||||
else
|
||||
render json: { sent_test_email_message: I18n.t("admin.email.sent_test") }
|
||||
end
|
||||
rescue => e
|
||||
render json: { errors: [e.message] }, status: 422
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user