Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Only cache editText links for admins

Oliver Günthere5e2fa817bf1
diff --git a/lib/api/v3/help_texts/help_text_representer.rb b/lib/api/v3/help_texts/help_text_representer.rb
index 75cec045b9c..ba31be3f966 100644
--- a/lib/api/v3/help_texts/help_text_representer.rb
+++ b/lib/api/v3/help_texts/help_text_representer.rb
@@ -38,8 +38,9 @@ module API
id_attribute: :id,
title_getter: ->(*) {}
- link :editText do
- if current_user.admin? && represented.persisted?
+ link :editText,
+ cache_if: -> { current_user.admin? } do
+ if represented.persisted?
{
href: edit_attribute_help_text_path(represented.id),
type: 'text/html'