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

Try removing unused callbacks

Dombi Attilaed36d46c7db7
diff --git a/app/services/projects/concerns/new_project_service.rb b/app/services/projects/concerns/new_project_service.rb
index 8de279e09a1..c22c0993ccb 100644
--- a/app/services/projects/concerns/new_project_service.rb
+++ b/app/services/projects/concerns/new_project_service.rb
@@ -28,8 +28,6 @@
module Projects::Concerns
module NewProjectService
- include Projects::Concerns::ResetGlobalQueryHooks
-
private
def before_perform(params, service_call)
diff --git a/app/services/projects/concerns/reset_global_query_hooks.rb b/app/services/projects/concerns/reset_global_query_hooks.rb
deleted file mode 100644
index d678994067e..00000000000
--- a/app/services/projects/concerns/reset_global_query_hooks.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2024 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 Projects::Concerns
- module ResetGlobalQueryHooks
- private
-
- def after_validate(params, service_call)
- # we need to reset the query_available_custom_fields_on_global_level already after validation
- # as the update service just calls .valid? and returns if invalid
- # after_save is not touched in this case which causes the flag to stay active
- set_query_available_custom_fields_to_project_level(service_call.result)
-
- super
- end
-
- def after_perform(service_call)
- set_query_available_custom_fields_to_project_level(service_call.result)
-
- super
- end
-
- def set_query_available_custom_fields_to_project_level(model)
- # reset the query_available_custom_fields_on_global_level after saving
- # in order not to silently carry this setting in this instance
- model._query_available_custom_fields_on_global_level = nil
- end
- end
-end
diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb
index 4a60a3c8f16..acb644a13c0 100644
--- a/app/services/projects/update_service.rb
+++ b/app/services/projects/update_service.rb
@@ -29,7 +29,6 @@
module Projects
class UpdateService < ::BaseServices::Update
prepend Projects::Concerns::UpdateDemoData
- include Projects::Concerns::ResetGlobalQueryHooks
private
@@ -45,12 +44,6 @@ module Projects
ret
end
- def after_validate(params, service_call)
- super.tap do
- set_query_available_custom_fields_to_global_level
- end
- end
-
def after_perform(service_call)
ret = super
reset_section_scoped_validation
@@ -110,11 +103,5 @@ module Projects
# in order not to silently carry this setting in this instance
model._limit_custom_fields_validation_to_section_id = nil
end
-
- def set_query_available_custom_fields_to_global_level
- # query the available custom fields on a global level when updating custom field values
- # in order to support implicit activation of custom fields when values are provided during an update
- model._query_available_custom_fields_on_global_level = true
- end
end
end