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
Remove usage of journals.activity_type
Christophe Bliardd5a3b0019f0c
diff --git a/app/models/activities/base_activity_provider.rb b/app/models/activities/base_activity_provider.rbindex 7f51b4ca650..7ec7be02148 100644--- a/app/models/activities/base_activity_provider.rb+++ b/app/models/activities/base_activity_provider.rb@@ -122,9 +122,7 @@ class Activities::BaseActivityProviderenddef activitied_type- activity_type = self.class.name-- class_name = activity_type.demodulize+ class_name = self.class.name.demodulizeclass_name.gsub('ActivityProvider', '').constantizeenddiff --git a/app/models/journal.rb b/app/models/journal.rbindex f38a5241d33..96adca9b96d 100644--- a/app/models/journal.rb+++ b/app/models/journal.rb@@ -28,6 +28,7 @@class Journal < ApplicationRecordself.table_name = 'journals'+ self.ignored_columns += ['activity_type']include ::JournalChangesinclude ::JournalFormatterdiff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rbindex 6220481af7d..9d26bdb4bb1 100644--- a/app/models/wiki_content.rb+++ b/app/models/wiki_content.rb@@ -48,10 +48,6 @@ class WikiContent < ApplicationRecord}}- def activity_type- 'wiki_edits'- end-def visible?(user = User.current)page.visible?(user)enddiff --git a/app/models/work_package.rb b/app/models/work_package.rbindex a815d77e3e2..5c220678744 100644--- a/app/models/work_package.rb+++ b/app/models/work_package.rb@@ -207,11 +207,6 @@ class WorkPackage < ApplicationRecord(usr || User.current).allowed_to?(:view_work_packages, project)end- # ACTS AS JOURNALIZED- def activity_type- 'work_packages'- end-# RELATIONSdef blockers# return work_packages that block mediff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rbindex f2e9db111e6..08c54ec6ab6 100644--- a/app/services/journals/create_service.rb+++ b/app/services/journals/create_service.rb@@ -251,7 +251,6 @@ module Journalsjournable_id,journable_type,version,- activity_type,user_id,notes,created_at,@@ -263,7 +262,6 @@ module Journals:journable_id,:journable_type,COALESCE(max_journals.version, 0) + 1,- :activity_type,:user_id,:notes,#{journal_timestamp_sql(notes, ':created_at')},@@ -277,7 +275,6 @@ module Journalssanitize(journal_sql,notes:,journable_id: journable.id,- activity_type: journable.activity_type,journable_type:,user_id: user.id,created_at: journable_timestamp,diff --git a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/creation.rb b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/creation.rbindex 4d6e1330e49..520f79ef210 100644--- a/lib_static/plugins/acts_as_journalized/lib/acts/journalized/creation.rb+++ b/lib_static/plugins/acts_as_journalized/lib/acts/journalized/creation.rb@@ -82,12 +82,6 @@ module Acts::Journalizeddef journaled_columns_namesself.class.journal_class.journaled_attributesend-- # Returns the activity type. Should be overridden in the journalized class to offer- # multiple types- def activity_type- self.class.name.underscore.pluralize- endendendenddiff --git a/modules/budgets/app/models/budget.rb b/modules/budgets/app/models/budget.rbindex f0dd282d995..b604b7c1f44 100644--- a/modules/budgets/app/models/budget.rb+++ b/modules/budgets/app/models/budget.rb@@ -128,11 +128,6 @@ class Budget < ApplicationRecordsubjectend- # override acts_as_journalized method- def activity_type- self.class.plural_name- end-def material_budget@material_budget ||= material_budget_items.visible_costs.inject(BigDecimal('0.0000')) { |sum, i| sum += i.costs }enddiff --git a/modules/meeting/spec/factories/meeting_journal_factory.rb b/modules/meeting/spec/factories/meeting_journal_factory.rbindex ea863c69959..cc65d1668d4 100644--- a/modules/meeting/spec/factories/meeting_journal_factory.rb+++ b/modules/meeting/spec/factories/meeting_journal_factory.rb@@ -33,7 +33,6 @@ FactoryBot.define dofactory :meeting_content_journal, class: 'Journal' dojournable_type { 'MeetingContent' }- activity_type { 'meetings' }endendenddiff --git a/spec/factories/journal_factory.rb b/spec/factories/journal_factory.rbindex 85e9524af02..845bec155ca 100644--- a/spec/factories/journal_factory.rb+++ b/spec/factories/journal_factory.rb@@ -34,7 +34,6 @@ FactoryBot.define dofactory :work_package_journal, class: 'Journal' dojournable_type { 'WorkPackage' }- activity_type { 'work_packages' }data { build(:journal_work_package_journal) }callback(:after_stub) do |journal, options|@@ -44,19 +43,16 @@ FactoryBot.define dofactory :wiki_content_journal, class: 'Journal' dojournable_type { 'WikiContent' }- activity_type { 'wiki_edits' }data { build(:journal_wiki_content_journal) }endfactory :message_journal, class: 'Journal' dojournable_type { 'Message' }- activity_type { 'messages' }data { build(:journal_message_journal) }endfactory :news_journal, class: 'Journal' dojournable_type { 'News' }- activity_type { 'news' }data { build(:journal_message_journal) }endend