RGJ
(Richard - Communiteq)
2025 年 4 月 22 日午前 10:03
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
Moin
2025 年 4 月 22 日午前 10:29
2
I think the problem with ‘everyone’ and templates has already been reported in "everyone" group unable to see private templates
「いいね!」 1
RGJ
(Richard - Communiteq)
2025 年 4 月 22 日午前 10:42
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
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.
「いいね!」 3