FIX: Allow sending test e-mails to any email address when disable_email is set to non-staff (#6792)

This commit is contained in:
Rishabh
2018-12-18 20:42:05 +05:30
committed by Régis Hanol
parent 32784ad11a
commit c279792130
5 changed files with 5 additions and 12 deletions

View File

@ -13,8 +13,6 @@ class Admin::EmailController < Admin::AdminController
Jobs::TestEmail.new.execute(to_address: params[:email_address])
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