RGJ
(Richard - Communiteq)
April 22, 2025, 10:03am
1
When “Everyone” is added to discourse_templates_groups_allowed_private_templates
, the functionality breaks for everyone except staff.
So “Everyone, trust_level_0” does not work, while “trust_level_0” does work.
Culprit:
def can_use_private_templates?
return false unless SiteSetting.discourse_templates_enable_private_templates
return false unless SiteSetting.tagging_enabled
return false if SiteSetting.discourse_templates_private_templates_tags.blank?
return true if guardian.is_staff?
allowed_groups_ids =
SiteSetting.discourse_templates_groups_allowed_private_templates&.split("|")&.map(&:to_i)
allowed_groups_ids.any? do |group_id|
return false if group_id == 0
# the user can use templates if belongs to at least one of the allowed groups
GroupUser.exists?(group_id: group_id, user_id: self.id)
end
end
return false if group_id == 0
3 Likes
Moin
April 22, 2025, 10:29am
2
I think the problem with ‘everyone’ and templates has already been reported in "everyone" group unable to see private templates
1 Like
RGJ
(Richard - Communiteq)
April 22, 2025, 10:42am
3
Yes, I see it now, thanks.
I misread that bug, I thought that simply “everyone” did not work, I did not realize it broke it for all other added groups as well.
Reported 1.5 years ago
4 Likes
Thank you for reporting this bug. It was fixed in this PR:
main
← private-everyone
opened 06:55AM - 23 Apr 25 UTC
When private template allowed group is everyone, `can_use_private_templates?` me… thod should return true.
2 Likes