mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 02:04:53 +08:00
FEATURE: allow end users to opt out of getting any private messages
This commit is contained in:
@ -260,6 +260,8 @@ class Guardian
|
||||
(SiteSetting.enable_private_messages ||
|
||||
@user.username == SiteSetting.site_contact_username ||
|
||||
@user == Discourse.system_user) &&
|
||||
# Only staff can send PMs to users that opt-out
|
||||
(!target.is_a?(User) || is_staff? || target.user_profile.allow_private_messages) &&
|
||||
# Can't send PMs to suspended users
|
||||
(is_staff? || target.is_a?(Group) || !target.suspended?)
|
||||
end
|
||||
|
Reference in New Issue
Block a user