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

Restrict custom value cache key to section

Dombi Attila1b5bba172822
diff --git a/app/models/projects/acts_as_customizable_patches.rb b/app/models/projects/acts_as_customizable_patches.rb
index 50455dc4cb0..8f4fdc7bde3 100644
--- a/app/models/projects/acts_as_customizable_patches.rb
+++ b/app/models/projects/acts_as_customizable_patches.rb
@@ -155,7 +155,7 @@ module Projects::ActsAsCustomizablePatches
#
# additionally we provide the `global` parameter to allow querying the available custom fields on a global level
# when we have explicit control over the call of `available_custom_fields`
- unless global_custom_fields_enabled?
+ unless new_record? || previously_new_record? || _query_available_custom_fields_on_global_level
custom_fields = custom_fields
.where(id: project_custom_field_project_mappings.select(:custom_field_id))
.or(ProjectCustomField.required)
@@ -164,14 +164,6 @@ module Projects::ActsAsCustomizablePatches
custom_fields
end
- def global_custom_fields_enabled?
- global_custom_field_flags.any?(&:present?)
- end
-
- def global_custom_field_flags
- [new_record?, previously_new_record?, _query_available_custom_fields_on_global_level]
- end
-
def all_available_custom_fields
with_all_available_custom_fields { available_custom_fields }
end
@@ -180,7 +172,7 @@ module Projects::ActsAsCustomizablePatches
# that are factored in the calculation of the available_custom_fields method should be included
# in the custom_values_cache_key too.
def custom_values_cache_key
- [*global_custom_field_flags, _limit_custom_fields_validation_to_section_id]
+ [_limit_custom_fields_validation_to_section_id]
end
# we need to query the available custom fields on a global level when updating custom field values