Greetings!
I’ve encountered a slight issue, not sure if this is by design for some reason, but it seems that staff moderators are not included in can_invite_to(o,g)
when SiteSetting.enable_private_messages
is disabled. This makes mods unable to invite other moderators or groups to private messages / warnings.
Lines 248-260 in guardian.rb seem to describe that administrators can ignore the enable_private_messages just fine, but staff moderators appear to be left out.
Would it be viable to replace is_admin
with is_staff
here?
def can_invite_to?(object, group_ids=nil)
return false unless authenticated?
- return true if is_admin?
+ return true if is_staff?
return false unless SiteSetting.enable_private_messages?
return false if (SiteSetting.max_invites_per_day.to_i == 0 && !is_staff?)
return false unless can_see?(object)
return false if group_ids.present?
if object.is_a?(Topic) && object.category
if object.category.groups.any?
return true if object.category.groups.all? { |g| can_edit_group?(g) }
end
end
Reproduction steps:
As admin
- Have private messages disabled
- Send a message / warning to any user
- Invite moderators group to convo with “invite others…” button
As staff moderator
- Have private messages disabled
- Send a message / warning to any user
- Notice missing “invite other…” button, cannot involve other moderators / staff members