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
Put journal "cause" as first item in journal details
Christophe Bliard4d2da2bf649b
diff --git a/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb b/lib_static/plugins/acts_as_journalized/lib/journal_changes.rbindex 5371fa17773..77c4569300e 100644--- a/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb+++ b/lib_static/plugins/acts_as_journalized/lib/journal_changes.rb@@ -31,57 +31,73 @@ module JournalChangesreturn @changes if @changesreturn {} if data.nil?- @changes = ::Acts::Journalized::JournableDiffer.changes(predecessor&.data, data)+ changes = [+ get_cause_changes,+ get_data_changes,+ get_attachments_changes,+ get_custom_fields_changes,+ get_file_links_changes,+ get_agenda_items_changes+ ].compact- @changes[:cause] = [nil, cause] if cause.present?+ @changes = changes.reduce({}, :merge!)+ end++ def get_cause_changes+ return if cause.blank?- if journable&.attachable?- @changes.merge!(- ::Acts::Journalized::JournableDiffer.association_changes(- predecessor,- self,- 'attachable_journals',- 'attachments',- :attachment_id,- :filename- )- )- end+ { cause: [nil, cause] }+ end- if journable&.customizable?- @changes.merge!(- ::Acts::Journalized::JournableDiffer.association_changes(- predecessor,- self,- 'customizable_journals',- 'custom_fields',- :custom_field_id,- :value- )- )- end+ def get_data_changes+ ::Acts::Journalized::JournableDiffer.changes(predecessor&.data, data)+ end++ def get_attachments_changes+ return unless journable&.attachable?++ ::Acts::Journalized::JournableDiffer.association_changes(+ predecessor,+ self,+ "attachable_journals",+ "attachments",+ :attachment_id,+ :filename+ )+ end++ def get_custom_fields_changes+ return unless journable&.customizable?++ ::Acts::Journalized::JournableDiffer.association_changes(+ predecessor,+ self,+ "customizable_journals",+ "custom_fields",+ :custom_field_id,+ :value+ )+ end++ def get_file_links_changes+ return unless has_file_links?++ ::Acts::Journalized::FileLinkJournalDiffer.get_changes_to_file_links(+ predecessor,+ storable_journals+ )+ end- if has_file_links?- @changes.merge!(- ::Acts::Journalized::FileLinkJournalDiffer.get_changes_to_file_links(- predecessor,- storable_journals- )- )- end+ def get_agenda_items_changes+ return unless journable.respond_to?(:agenda_items)- if journable.respond_to?(:agenda_items)- @changes.merge!(- ::Acts::Journalized::JournableDiffer.association_changes_multiple_attributes(- predecessor,- self,- 'agenda_item_journals',- 'agenda_items',- :agenda_item_id,- [:title, :duration_in_minutes, :notes, :position, :work_package_id]- )- )- end- @changes+ ::Acts::Journalized::JournableDiffer.association_changes_multiple_attributes(+ predecessor,+ self,+ "agenda_item_journals",+ "agenda_items",+ :agenda_item_id,+ %i[title duration_in_minutes notes position work_package_id]+ )endend