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
fix[Op#55133]: make it explicit that mappings reuse the same contract
Kabiru Mwenjab2be225f8f65
diff --git a/app/contracts/project_custom_field_project_mappings/delete_contract.rb b/app/contracts/project_custom_field_project_mappings/delete_contract.rbdeleted file mode 100644index 7392d8d7bdf..00000000000--- a/app/contracts/project_custom_field_project_mappings/delete_contract.rb+++ /dev/null@@ -1,33 +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 ProjectCustomFieldProjectMappings- class DeleteContract < ::DeleteContract- delete_permission :select_project_custom_fields- end-enddiff --git a/app/services/project_custom_field_project_mappings/delete_service.rb b/app/services/project_custom_field_project_mappings/delete_service.rbindex 3e0b4501a18..5c3a03feef8 100644--- a/app/services/project_custom_field_project_mappings/delete_service.rb+++ b/app/services/project_custom_field_project_mappings/delete_service.rb@@ -28,5 +28,10 @@module ProjectCustomFieldProjectMappingsclass DeleteService < ::BaseServices::Delete+ # Mappings have custom deletion rules that are similar to the update rules all derived from the base contract+ # Reuse the update contract to ensure that the deletion rules are consistent with the update rules+ def default_contract_class+ ProjectCustomFieldProjectMappings::UpdateContract+ endendenddiff --git a/spec/services/project_custom_field_project_mappings/delete_service_spec.rb b/spec/services/project_custom_field_project_mappings/delete_service_spec.rbindex e81be32e838..4520872b818 100644--- a/spec/services/project_custom_field_project_mappings/delete_service_spec.rb+++ b/spec/services/project_custom_field_project_mappings/delete_service_spec.rb@@ -32,5 +32,8 @@ require "services/base_services/behaves_like_delete_service"RSpec.describe ProjectCustomFieldProjectMappings::DeleteService doit_behaves_like "BaseServices delete service" dolet(:factory) { :project_custom_field_project_mapping }+ let(:contract_class) do+ "#{namespace}::UpdateContract".constantize+ endendend