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
filter for activated custom fields when querying customizable journals instead of afterwards
Ivan Kuchin96d0e4cc634c
diff --git a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rbindex 5f499d3ecd9..9647d99d97e 100644--- a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb+++ b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/differ/association.rb@@ -61,7 +61,13 @@ module Acts::Journalized::Differid_attribute = id_attribute.to_s- model.send(association).map(&:attributes).group_by { _1[id_attribute] }+ relation = if association.respond_to?(:call)+ association.call(model)+ else+ model.send(association)+ end++ relation.map(&:attributes).group_by { _1[id_attribute] }enddef single_attribute_changes(attribute)diff --git a/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb b/lib_static/plugins/acts_as_journalized/lib/journal_changes.rbindex 8e638521bbb..f67a00cab32 100644--- a/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb+++ b/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb@@ -71,21 +71,25 @@ module JournalChangesdef get_custom_fields_changesreturn unless journable&.customizable?- customizable_changes = ::Acts::Journalized::Differ::Association.new(+ association = if journable.is_a?(::Project)+ ->(journal) {+ journal.customizable_journals+ .with(cf_mappings: journable.project_custom_field_project_mappings)+ .joins("INNER JOIN cf_mappings USING (custom_field_id)")+ }+ else+ :customizable_journals+ end++ ::Acts::Journalized::Differ::Association.new(predecessor,self,- association: :customizable_journals,+ association:,id_attribute: :custom_field_id).attribute_changes(:value,key_prefix: "custom_fields")-- if journable.class.name == "Project"- remove_disabled_project_custom_fields!(customizable_changes)- end-- customizable_changesenddef get_project_life_cycle_steps_changes@@ -125,14 +129,4 @@ module JournalChangeskey_prefix: "agenda_items")end-- private-- def remove_disabled_project_custom_fields!(customizable_changes)- allowed_custom_field_keys = journable- .project_custom_field_project_mappings- .map { |c| "custom_fields_#{c.custom_field_id}" }-- customizable_changes.delete_if { |key| !key.in?(allowed_custom_field_keys) }- endend