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 dead code

Christophe Bliarde0ff976427b3
diff --git a/modules/backlogs/lib/open_project/backlogs/engine.rb b/modules/backlogs/lib/open_project/backlogs/engine.rb
index 74210dbd840..b3f57372c7b 100644
--- a/modules/backlogs/lib/open_project/backlogs/engine.rb
+++ b/modules/backlogs/lib/open_project/backlogs/engine.rb
@@ -132,7 +132,6 @@ module OpenProject::Backlogs
VersionsController
Version]
- patch_with_namespace :API, :V3, :WorkPackages, :Schema, :SpecificWorkPackageSchema
patch_with_namespace :WorkPackages, :UpdateAncestors, :Loader
patch_with_namespace :BasicData, :SettingSeeder
patch_with_namespace :DemoData, :ProjectSeeder
diff --git a/modules/backlogs/lib/open_project/backlogs/patches/specific_work_package_schema_patch.rb b/modules/backlogs/lib/open_project/backlogs/patches/specific_work_package_schema_patch.rb
deleted file mode 100644
index 1cb60f9fdb0..00000000000
--- a/modules/backlogs/lib/open_project/backlogs/patches/specific_work_package_schema_patch.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 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 OpenProject::Backlogs::Patches::SpecificWorkPackageSchemaPatch
- def self.included(base)
- base.class_eval do
- prepend InstanceMethods
- extend ClassMethods
- end
- end
-
- module ClassMethods
- end
-
- module InstanceMethods
- def writable?(property)
- if property == :remaining_time && !@work_package.leaf?
- false
- elsif version_with_backlogs_parent(property)
- false
- else
- super
- end
- end
-
- private
-
- def version_with_backlogs_parent(property)
- property == :version && @work_package.is_task? && WorkPackage.find(@work_package.parent_id).in_backlogs_type?
- end
- end
-end
diff --git a/modules/backlogs/spec/api/work_packages/schema/specific_work_package_schema_spec.rb b/modules/backlogs/spec/api/work_packages/schema/specific_work_package_schema_spec.rb
deleted file mode 100644
index 797b1137a28..00000000000
--- a/modules/backlogs/spec/api/work_packages/schema/specific_work_package_schema_spec.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2023 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.
-#++
-
-require 'spec_helper'
-
-RSpec.describe API::V3::WorkPackages::Schema::SpecificWorkPackageSchema do
- let(:project) { build(:project) }
- let(:type) { build(:type) }
- let(:work_package) { build(:work_package, project:, type:) }
- let(:current_user) { build_stubbed(:user) }
-
- before do
- mock_permissions_for(current_user, &:allow_everything)
-
- login_as(current_user)
- end
-
- shared_examples_for 'with parent which is a BACKLOGS type' do |writable|
- let(:parent) { create(:work_package, type: type_task) }
-
- before do
- work_package.parent_id = parent.id
- work_package.save!
- end
-
- it "is #{'not' unless writable} writable" do
- if writable
- expect(subject).to be_writable(:version)
- else
- expect(subject).not_to be_writable(:version)
- end
- end
- end
-
- shared_examples_for 'with parent which is not a BACKLOGS type' do
- let(:parent) { create(:work_package, type: type_feature) }
-
- before do
- work_package.parent_id = parent.id
- work_package.save!
- end
-
- it "is writable" do
- expect(subject).to be_writable(:version)
- end
- end
-
- describe '#writable? for remaining_hours' do
- subject { described_class.new(work_package:) }
-
- context 'work_package is a leaf' do
- before do
- allow(work_package).to receive(:leaf?).and_return(true)
- end
-
- it 'is writable' do
- expect(subject).to be_writable(:remaining_hours)
- end
- end
-
- context 'work_package is no leaf' do
- before do
- allow(work_package).to receive(:leaf?).and_return(false)
- end
-
- it 'is not writable' do
- expect(subject).not_to be_writable(:remaining_hours)
- end
- end
- end
-
- describe '#version_writable?' do
- subject { described_class.new(work_package:) }
-
- let(:type_task) { create(:type_task) }
- let(:type_feature) { create(:type_feature) }
-
- before do
- allow(WorkPackage).to receive(:backlogs_types).and_return([type_task.id])
- allow(work_package).to receive(:backlogs_enabled?).and_return(true)
- end
-
- describe 'work_package is a task' do
- before do
- allow(work_package)
- .to receive(:is_task?)
- .and_return(true)
- end
-
- it_behaves_like 'with parent which is a BACKLOGS type', false
- it_behaves_like 'with parent which is not a BACKLOGS type'
- end
-
- describe 'work_package is no task' do
- before do
- allow(work_package)
- .to receive(:is_task?)
- .and_return(false)
- end
-
- it_behaves_like 'with parent which is a BACKLOGS type', true
- it_behaves_like 'with parent which is not a BACKLOGS type'
- end
- end
-end