2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: Regular users shouldn't be able to invite to PMs if disabled

This commit is contained in:
Robin Ward 2017-05-19 12:55:26 -04:00
parent c0c6cb8124
commit 28f486cb7a
2 changed files with 59 additions and 29 deletions

View file

@ -232,10 +232,11 @@ class Guardian
end
def can_invite_to?(object, group_ids=nil)
return false if ! authenticated?
return false unless authenticated?
return true if is_admin?
return false unless SiteSetting.enable_private_messages?
return false if (SiteSetting.max_invites_per_day.to_i == 0 && !is_staff?)
return false if ! can_see?(object)
return false unless can_see?(object)
return false if group_ids.present?
if object.is_a?(Topic) && object.category