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
evaluate changes on journal creation only for supported associations
ulfertsbb33e3939525
diff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rbindex 3309da5dbbd..6c5758cca8c 100644--- a/app/services/journals/create_service.rb+++ b/app/services/journals/create_service.rb@@ -229,6 +229,14 @@ module Journalsdef relation_modifications_sql(predecessor)relations = []+ for_supported_associations do |association|+ relations << association_modifications_sql(association, predecessor)+ end++ relations+ end++ def for_supported_associationsassociations = {attachable?: :attachable,customizable?: :customizable,@@ -238,11 +246,9 @@ module Journalsassociations.each do |is_associated, association|if journable.respond_to?(is_associated)- relations << association_modifications_sql(association, predecessor)+ yield associationendend-- relationsenddef association_modifications_sql(association, predecessor)@@ -612,28 +618,23 @@ module Journalsenddef select_changed_sql- <<~SQL+ sql = <<~SQLSELECT*FROM(#{data_changes_sql}) data_changes- FULL JOIN- (#{customizable_changes_sql}) customizable_changes- ON- customizable_changes.journable_id = data_changes.journable_id- FULL JOIN- (#{attachable_changes_sql}) attachable_changes- ON- attachable_changes.journable_id = data_changes.journable_id- FULL JOIN- (#{storable_changes_sql}) storable_changes- ON- storable_changes.journable_id = data_changes.journable_id- FULL JOIN- (#{agenda_itemable_changes_sql}) agenda_itemable_changes- ON- agenda_itemable_changes.journable_id = data_changes.journable_idSQL++ for_supported_associations do |association|+ sql += <<~SQL+ FULL JOIN+ (#{send(:"#{association}_changes_sql")}) #{association}_changes+ ON+ #{association}_changes.journable_id = data_changes.journable_id+ SQL+ end++ sqlenddef attachable_changes_sql