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
Journalize the item_type in the MeetingAgendaItemJournal
Dombi Attilaf5144faa52a7
diff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rbindex 01ed0621561..6bebbc38a18 100644--- a/app/services/journals/create_service.rb+++ b/app/services/journals/create_service.rb@@ -476,7 +476,8 @@ module Journalsduration_in_minutes,start_time,end_time,- work_package_id+ work_package_id,+ item_type)SELECT#{id_from_inserted_journal_sql},@@ -488,7 +489,8 @@ module Journalsagenda_items.duration_in_minutes,agenda_items.start_time,agenda_items.end_time,- agenda_items.work_package_id+ agenda_items.work_package_id,+ agenda_items.item_typeFROM meeting_agenda_items agenda_itemsWHERE#{only_if_created_sql}@@ -721,6 +723,7 @@ module JournalsOR (agenda_items.start_time IS DISTINCT FROM meeting_agenda_item_journals.start_time)OR (agenda_items.end_time IS DISTINCT FROM meeting_agenda_item_journals.end_time)OR (agenda_items.work_package_id IS DISTINCT FROM meeting_agenda_item_journals.work_package_id)+ OR (agenda_items.item_type IS DISTINCT FROM meeting_agenda_item_journals.item_type)SQLsanitize(agenda_itemable_changes_sql,diff --git a/db/migrate/20231012124745_add_type_for_meeting_agenda_items.rb b/db/migrate/20231012124745_add_item_type_to_meeting_agenda_items.rbsimilarity index 60%rename from db/migrate/20231012124745_add_type_for_meeting_agenda_items.rbrename to db/migrate/20231012124745_add_item_type_to_meeting_agenda_items.rbindex f593df81f6a..dac26a0ad63 100644--- a/db/migrate/20231012124745_add_type_for_meeting_agenda_items.rb+++ b/db/migrate/20231012124745_add_item_type_to_meeting_agenda_items.rb@@ -1,4 +1,4 @@-class AddTypeForMeetingAgendaItems < ActiveRecord::Migration[7.0]+class AddItemTypeToMeetingAgendaItems < ActiveRecord::Migration[7.0]def changeadd_column :meeting_agenda_items, :item_type, :integer, limit: 1, default: 0enddiff --git a/db/migrate/20231013114720_add_item_type_to_meeting_agenda_item_journal.rb b/db/migrate/20231013114720_add_item_type_to_meeting_agenda_item_journal.rbnew file mode 100644index 00000000000..27a6338e23d--- /dev/null+++ b/db/migrate/20231013114720_add_item_type_to_meeting_agenda_item_journal.rb@@ -0,0 +1,5 @@+class AddItemTypeToMeetingAgendaItemJournal < ActiveRecord::Migration[7.0]+ def change+ add_column :meeting_agenda_item_journals, :item_type, :integer, limit: 1+ end+enddiff --git a/modules/meeting/app/models/journal/meeting_agenda_item_journal.rb b/modules/meeting/app/models/journal/meeting_agenda_item_journal.rbindex 637af1b5380..42c9c5d45a7 100644--- a/modules/meeting/app/models/journal/meeting_agenda_item_journal.rb+++ b/modules/meeting/app/models/journal/meeting_agenda_item_journal.rb@@ -29,6 +29,8 @@class Journal::MeetingAgendaItemJournal < Journal::BaseJournalself.table_name = 'meeting_agenda_item_journals'+ enum item_type: MeetingAgendaItem::ITEM_TYPES+belongs_to :meetingbelongs_to :author, class_name: 'User'belongs_to :agenda_item, class_name: 'MeetingAgendaItem'diff --git a/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb b/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rbindex 72232173994..b375a7d4ef5 100644--- a/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb+++ b/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb@@ -106,8 +106,8 @@ RSpec.describe Meeting doit {expect(agenda_item_journals.last).to have_attributes agenda_item.attributes.slice(- "author_id", "title", "notes", "position", "duration_in_minutes",- "start_time", "end_time", "work_package_id"+ 'author_id', 'title', 'notes', 'position', 'duration_in_minutes',+ 'start_time', 'end_time', 'work_package_id', 'item_type')}end@@ -119,8 +119,8 @@ RSpec.describe Meeting doit {expect(agenda_item_journals.last).to have_attributes agenda_item.attributes.slice(- "author_id", "title", "notes", "position", "duration_in_minutes",- "start_time", "end_time", "work_package_id"+ 'author_id', 'title', 'notes', 'position', 'duration_in_minutes',+ 'start_time', 'end_time', 'work_package_id', 'item_type')}end@@ -135,11 +135,11 @@ RSpec.describe Meeting doendJournal::MeetingAgendaItemJournal.columns_hash.slice(- "notes", "position", "duration_in_minutes", "work_package_id"+ 'notes', 'position', 'duration_in_minutes', 'work_package_id', 'item_type').each do |column_name, column_info|column_value =- case column_info.type- when :integer then 11+ if column_name == 'item_type' then 'work_package'+ elsif column_info.type == :integer then 11else 'A string'end@@ -259,8 +259,8 @@ RSpec.describe Meeting doit {remove_agenda_itemexpect(agenda_item_journals.last).to have_attributes agenda_item.attributes.slice(- "author_id", "title", "notes", "position", "duration_in_minutes",- "start_time", "end_time", "work_package_id"+ 'author_id', 'title', 'notes', 'position', 'duration_in_minutes',+ 'start_time', 'end_time', 'work_package_id')}