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
Load STI models explicitly.
Pavel Balashoub78678c5ece4
diff --git a/app/models/concerns/subclass_registry.rb b/app/models/concerns/subclass_registry.rbdeleted file mode 100644index 37159680d38..00000000000--- a/app/models/concerns/subclass_registry.rb+++ /dev/null@@ -1,45 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++--module SubclassRegistry- extend ActiveSupport::Concern-- included do- class_attribute :registered_subclasses, default: []- end-- class_methods do- def register_subclass(subclass)- raise ArgumentError, "#{subclass} needs to inherit from #{self}" unless subclass < self-- unless registered_subclasses.include?(subclass)- registered_subclasses << subclass- end- end- end-enddiff --git a/app/models/deleted_user.rb b/app/models/deleted_user.rbindex ad89f12e71e..e65817ea514 100644--- a/app/models/deleted_user.rb+++ b/app/models/deleted_user.rb@@ -1,3 +1,33 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#+++class DeletedUser < Userdef self.firstsuper || create(type: to_s, status: statuses[:locked])diff --git a/app/models/enumeration.rb b/app/models/enumeration.rbindex d6c653771df..e31dcdf202d 100644--- a/app/models/enumeration.rb+++ b/app/models/enumeration.rb@@ -27,8 +27,6 @@#++class Enumeration < ApplicationRecord- include SubclassRegistry-default_scope { order("#{Enumeration.table_name}.position ASC") }belongs_to :project, optional: truediff --git a/config/initializers/sti_eager_load.rb b/config/initializers/sti_eager_load.rbindex 686afe5db85..ea2da38bc8d 100644--- a/config/initializers/sti_eager_load.rb+++ b/config/initializers/sti_eager_load.rb@@ -1,3 +1,5 @@+# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbH@@ -27,5 +29,18 @@#++Rails.application.config.to_prepare do- Enumeration.register_subclass(IssuePriority)+ # Load Enumeration descendants due to STI+ IssuePriority++ # Load Principal descendants due to STI+ User+ PlaceholderUser+ Group++ # Use User descendants due to STI+ SystemUser+ AnonymousUser+ Users::InexistentUser+ ServiceAccount+ DeletedUserenddiff --git a/modules/auth_saml/lib/open_project/auth_saml/engine.rb b/modules/auth_saml/lib/open_project/auth_saml/engine.rbindex ea3dafc4dde..7e8310b2816 100644--- a/modules/auth_saml/lib/open_project/auth_saml/engine.rb+++ b/modules/auth_saml/lib/open_project/auth_saml/engine.rb@@ -66,6 +66,11 @@ module OpenProjectdefault: {},format: :hashend++ config.to_prepare do+ # Load AuthProvider descendants due to STI+ Saml::Provider+ endendendenddiff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rbindex f62be67afc3..2771bed1cd1 100644--- a/modules/costs/lib/costs/engine.rb+++ b/modules/costs/lib/costs/engine.rb@@ -311,7 +311,9 @@ module Costsendconfig.to_prepare do- Enumeration.register_subclass(TimeEntryActivity)+ # Load Enumeration descendants due to STI+ TimeEntryActivity+OpenProject::ProjectLatestActivity.register on: "TimeEntry"Costs::Patches::MembersPatch.mixin!diff --git a/modules/documents/lib/open_project/documents/engine.rb b/modules/documents/lib/open_project/documents/engine.rbindex f8aae7c5b3e..d54d2e707b2 100644--- a/modules/documents/lib/open_project/documents/engine.rb+++ b/modules/documents/lib/open_project/documents/engine.rb@@ -86,7 +86,8 @@ module OpenProject::Documentsadditional_permitted_attributes search: %i(documents)config.to_prepare do- Enumeration.register_subclass(DocumentCategory)+ # Load Enumeration descendants due to STI+ DocumentCategoryendendenddiff --git a/modules/openid_connect/lib/open_project/openid_connect/engine.rb b/modules/openid_connect/lib/open_project/openid_connect/engine.rbindex 454180fde2c..02544027b16 100644--- a/modules/openid_connect/lib/open_project/openid_connect/engine.rb+++ b/modules/openid_connect/lib/open_project/openid_connect/engine.rb@@ -108,6 +108,9 @@ module OpenProject::OpenIDConnectconfig.to_prepare do::OpenProject::OpenIDConnect::Hooks::Hook++ # Load AuthProvider descendants due to STI+ OpenIDConnect::Providerendendenddiff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rbindex b4465a7ac4a..c54fb8bed40 100644--- a/modules/storages/lib/open_project/storages/engine.rb+++ b/modules/storages/lib/open_project/storages/engine.rb@@ -257,6 +257,11 @@ module OpenProject::Storages# This hook is executed when the module is loaded.config.to_prepare do+ # Load Storages::Storage descendants due to STI+ Storages::Storage::InexistentStorage+ Storages::OneDriveStorage+ Storages::NextcloudStorage+# Allow the browser to connect to external servers for direct file uploads.AppendStoragesHostsToCspHook