FIX: only send user suspension emails if email message provided (#12666)

This makes behavior consistent with documentation:

API:

> Will send an email with this message when present

Web UI:

> Optionally, provide more information about the suspension and it will be emailed to the user
This commit is contained in:
Ryan Mulligan
2021-04-12 08:03:10 -07:00
committed by GitHub
parent 65647000a1
commit 045adb76f2
2 changed files with 15 additions and 10 deletions

View File

@ -124,12 +124,14 @@ class Admin::UsersController < Admin::AdminController
end
@user.logged_out
Jobs.enqueue(
:critical_user_email,
type: :account_suspended,
user_id: @user.id,
user_history_id: user_history.id
)
if message && !message.empty?
Jobs.enqueue(
:critical_user_email,
type: :account_suspended,
user_id: @user.id,
user_history_id: user_history.id
)
end
DiscourseEvent.trigger(
:user_suspended,