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

decrease MethodABC size

ulferts701e8283b8e4
diff --git a/lib/api/v3/work_packages/schema/work_package_schema_representer.rb b/lib/api/v3/work_packages/schema/work_package_schema_representer.rb
index a7994a6077d..b42dbe1bafc 100644
--- a/lib/api/v3/work_packages/schema/work_package_schema_representer.rb
+++ b/lib/api/v3/work_packages/schema/work_package_schema_representer.rb
@@ -343,19 +343,23 @@ module API
end
def form_config_attribute_representation(group)
- cache_keys = ['wp_schema_attribute_group',
- group.key,
- I18n.locale,
- represented.project,
- represented.type,
- represented.available_custom_fields.sort_by(&:id)]
-
- OpenProject::Cache.fetch(OpenProject::Cache::CacheKey.expand(cache_keys.flatten.compact)) do
+ OpenProject::Cache.fetch(*form_config_attribute_cache_key(group)) do
::JSON::parse(::API::V3::WorkPackages::Schema::FormConfigurations::AttributeRepresenter
.new(group, current_user:, project: represented.project, embed_links: true)
.to_json)
end
end
+
+ def form_config_attribute_cache_key(group)
+ ['wp_schema_attribute_group',
+ group.key,
+ I18n.locale,
+ represented.project,
+ represented.type,
+ represented.available_custom_fields.sort_by(&:id)]
+ .flatten
+ .compact
+ end
end
end
end