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
Stop restricting task version by its parent
Christophe Bliard4fba34196a29
diff --git a/modules/backlogs/lib/open_project/backlogs/patches/base_contract_patch.rb b/modules/backlogs/lib/open_project/backlogs/patches/base_contract_patch.rbindex 088e6d0ecba..4f336c2bfbd 100644--- a/modules/backlogs/lib/open_project/backlogs/patches/base_contract_patch.rb+++ b/modules/backlogs/lib/open_project/backlogs/patches/base_contract_patch.rb@@ -31,17 +31,5 @@ module OpenProject::Backlogs::Patches::BaseContractPatchincluded doattribute :story_points-- validate :validate_has_parents_version-- private-- def validate_has_parents_version- if model.is_task? &&- model.parent && model.parent.in_backlogs_type? &&- model.version_id != model.parent.version_id- errors.add :version_id, :task_version_must_be_the_same_as_story_version- end- endendenddiff --git a/modules/backlogs/spec/contracts/work_packages/base_contract_spec.rb b/modules/backlogs/spec/contracts/work_packages/base_contract_spec.rbindex 60981e595ae..d2cde5da4e5 100644--- a/modules/backlogs/spec/contracts/work_packages/base_contract_spec.rb+++ b/modules/backlogs/spec/contracts/work_packages/base_contract_spec.rb@@ -163,65 +163,6 @@ RSpec.describe WorkPackages::BaseContract, type: :model doenddescribe 'version being restricted' do- shared_examples_for 'is invalid and notes the error' do- it 'is invalid and notes the error' do- expect(subject).to be_falsey- expect(instance.errors.symbols_for(:version_id))- .to contain_exactly(:task_version_must_be_the_same_as_story_version)- end- end-- shared_examples_for 'version being restricted by the parent' do- before do- work_package.parent ||= parent- end-- describe 'WITHOUT a version and the parent also having no version' do- before do- parent.version = nil- work_package.version = nil- end-- include_examples 'is valid'- end-- describe 'WITHOUT a version and the parent having a version' do- before do- parent.version = version1- work_package.version = nil- end-- include_examples 'is invalid and notes the error'- end-- describe 'WITH a version and the parent having a different version' do- before do- parent.version = version1- work_package.version = version2- end-- include_examples 'is invalid and notes the error'- end-- describe 'WITH a version and the parent having the same version' do- before do- parent.version = version1- work_package.version = version1- end-- include_examples 'is valid'- end-- describe 'WITH a version and the parent having no version' do- before do- parent.version = nil- work_package.version = version1- end-- include_examples 'is invalid and notes the error'- end- end-shared_examples_for 'version not being restricted by the parent' dobefore dowork_package.parent ||= parent@@ -325,13 +266,13 @@ RSpec.describe WorkPackages::BaseContract, type: :model dolet(:parent) { task2 }- include_examples 'version being restricted by the parent'+ it_behaves_like 'version not being restricted by the parent'enddescribe "WITH a story as its parent" dolet(:parent) { story }- include_examples 'version being restricted by the parent'+ it_behaves_like 'version not being restricted by the parent'enddescribe "WITH a non backlogs tracked work_package as its parent" do