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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Use global flag cache keys
Dombi Attilac2cd7c7e352e
diff --git a/app/models/projects/acts_as_customizable_patches.rb b/app/models/projects/acts_as_customizable_patches.rbindex d7dc07070d3..50455dc4cb0 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?+ unless global_custom_fields_enabled?custom_fields = custom_fields.where(id: project_custom_field_project_mappings.select(:custom_field_id)).or(ProjectCustomField.required)@@ -164,8 +164,12 @@ module Projects::ActsAsCustomizablePatchescustom_fieldsend- def global_custom_fields?- new_record? || previously_new_record? || _query_available_custom_fields_on_global_level+ 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]enddef all_available_custom_fields@@ -176,7 +180,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_fields?, _limit_custom_fields_validation_to_section_id]+ [*global_custom_field_flags, _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