mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Don't allow sending private messages to suspended users. Emails to suspended users should tell them how to respond, since they can't.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Builds a Mail::Mesage we can use for sending. Optionally supports using a template
|
||||
# Builds a Mail::Message we can use for sending. Optionally supports using a template
|
||||
# for the body and subject
|
||||
module Email
|
||||
|
||||
@@ -26,12 +26,16 @@ module Email
|
||||
user_preferences_url: "#{Discourse.base_url}/my/preferences" }.merge!(@opts)
|
||||
|
||||
if @template_args[:url].present?
|
||||
@template_args[:respond_instructions] =
|
||||
if allow_reply_by_email?
|
||||
I18n.t('user_notifications.reply_by_email', @template_args)
|
||||
else
|
||||
I18n.t('user_notifications.visit_link_to_respond', @template_args)
|
||||
end
|
||||
if @opts[:include_respond_instructions] == false
|
||||
@template_args[:respond_instructions] = ''
|
||||
else
|
||||
@template_args[:respond_instructions] =
|
||||
if allow_reply_by_email?
|
||||
I18n.t('user_notifications.reply_by_email', @template_args)
|
||||
else
|
||||
I18n.t('user_notifications.visit_link_to_respond', @template_args)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -215,7 +215,9 @@ class Guardian
|
||||
# PMs are enabled
|
||||
(SiteSetting.enable_private_messages ||
|
||||
@user.username == SiteSetting.site_contact_username ||
|
||||
@user == Discourse.system_user)
|
||||
@user == Discourse.system_user) &&
|
||||
# Can't send PMs to suspended users
|
||||
(is_staff? || target.is_a?(Group) || !target.suspended?)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user