mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Support for group everyone in tag setting (#17669)
The "everyone" group is an automatic group and GroupUser records do not exist for it. This commit allows all users if the group everyone is one of the groups in the setting "pm_tags_allowed_for_groups".
This commit is contained in:
@@ -11,8 +11,12 @@ module TagGuardian
|
||||
end
|
||||
|
||||
def can_tag_pms?
|
||||
return false if !SiteSetting.tagging_enabled
|
||||
return false if @user.blank?
|
||||
SiteSetting.tagging_enabled && @user == Discourse.system_user || @user.group_users.exists?(group_id: SiteSetting.pm_tags_allowed_for_groups.to_s.split("|").map(&:to_i))
|
||||
return true if @user == Discourse.system_user
|
||||
|
||||
group_ids = SiteSetting.pm_tags_allowed_for_groups.to_s.split("|").map(&:to_i)
|
||||
group_ids.include?(Group::AUTO_GROUPS[:everyone]) || @user.group_users.exists?(group_id: group_ids)
|
||||
end
|
||||
|
||||
def can_admin_tags?
|
||||
|
||||
Reference in New Issue
Block a user