Skip to content

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

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.rb
index 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::BaseActivityProvider
end
def activitied_type
- activity_type = self.class.name
-
- class_name = activity_type.demodulize
+ class_name = self.class.name.demodulize
class_name.gsub('ActivityProvider', '').constantize
end
diff --git a/app/models/journal.rb b/app/models/journal.rb
index f38a5241d33..96adca9b96d 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -28,6 +28,7 @@
class Journal < ApplicationRecord
self.table_name = 'journals'
+ self.ignored_columns += ['activity_type']
include ::JournalChanges
include ::JournalFormatter
diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb
index 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)
end
diff --git a/app/models/work_package.rb b/app/models/work_package.rb
index 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
-
# RELATIONS
def blockers
# return work_packages that block me
diff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rb
index f2e9db111e6..08c54ec6ab6 100644
--- a/app/services/journals/create_service.rb
+++ b/app/services/journals/create_service.rb
@@ -251,7 +251,6 @@ module Journals
journable_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 Journals
sanitize(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.rb
index 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::Journalized
def journaled_columns_names
self.class.journal_class.journaled_attributes
end
-
- # Returns the activity type. Should be overridden in the journalized class to offer
- # multiple types
- def activity_type
- self.class.name.underscore.pluralize
- end
end
end
end
diff --git a/modules/budgets/app/models/budget.rb b/modules/budgets/app/models/budget.rb
index f0dd282d995..b604b7c1f44 100644
--- a/modules/budgets/app/models/budget.rb
+++ b/modules/budgets/app/models/budget.rb
@@ -128,11 +128,6 @@ class Budget < ApplicationRecord
subject
end
- # 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 }
end
diff --git a/modules/meeting/spec/factories/meeting_journal_factory.rb b/modules/meeting/spec/factories/meeting_journal_factory.rb
index 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 do
factory :meeting_content_journal, class: 'Journal' do
journable_type { 'MeetingContent' }
- activity_type { 'meetings' }
end
end
end
diff --git a/spec/factories/journal_factory.rb b/spec/factories/journal_factory.rb
index 85e9524af02..845bec155ca 100644
--- a/spec/factories/journal_factory.rb
+++ b/spec/factories/journal_factory.rb
@@ -34,7 +34,6 @@ FactoryBot.define do
factory :work_package_journal, class: 'Journal' do
journable_type { 'WorkPackage' }
- activity_type { 'work_packages' }
data { build(:journal_work_package_journal) }
callback(:after_stub) do |journal, options|
@@ -44,19 +43,16 @@ FactoryBot.define do
factory :wiki_content_journal, class: 'Journal' do
journable_type { 'WikiContent' }
- activity_type { 'wiki_edits' }
data { build(:journal_wiki_content_journal) }
end
factory :message_journal, class: 'Journal' do
journable_type { 'Message' }
- activity_type { 'messages' }
data { build(:journal_message_journal) }
end
factory :news_journal, class: 'Journal' do
journable_type { 'News' }
- activity_type { 'news' }
data { build(:journal_message_journal) }
end
end