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
remove almost duplicate, but faulty, readonly check
ulfertsa2a559e55328
diff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rbindex deea6d3e553..786d2c28d46 100644--- a/app/contracts/work_packages/base_contract.rb+++ b/app/contracts/work_packages/base_contract.rb@@ -136,7 +136,7 @@ module WorkPackagesret = super# If we're in a readonly status and did not move into that status right now- # only allow other status transitions+ # only allow other status transitions. But also prevent that if the associated version is closed.if model.readonly_status? && !model.status_id_changeret &= %w(status status_id)enddiff --git a/lib/api/v3/work_packages/schema/base_work_package_schema.rb b/lib/api/v3/work_packages/schema/base_work_package_schema.rbindex 288d2797157..55d7e8d5ac2 100644--- a/lib/api/v3/work_packages/schema/base_work_package_schema.rb+++ b/lib/api/v3/work_packages/schema/base_work_package_schema.rb@@ -55,9 +55,6 @@ module APIdef writable?(property)property = property.to_sym- # Special case for readonly: Only status is allowed- return property == :status if readonly?-# Special case for milestones + date propertyproperty = :start_date if property == :date && milestone?diff --git a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rbindex b5dd6609272..e46f60a8c12 100644--- a/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb+++ b/spec/lib/api/v3/work_packages/schema/specific_work_package_schema_spec.rb@@ -40,7 +40,7 @@ describe ::API::V3::WorkPackages::Schema::SpecificWorkPackageSchema dodouble('current user').tap do |u|allow(u).to receive(:allowed_to?)- .and_return(true)+ .and_return(true)endend@@ -92,9 +92,11 @@ describe ::API::V3::WorkPackages::Schema::SpecificWorkPackageSchema do.to receive(:readonly_status?).and_return(false)- is_expected.to_not be_readonly- expect(subject.writable?(:status)).to be_truthy- expect(subject.writable?(:subject)).to be_truthy+ # As the writability is memoized we need to have a new schema+ new_schema = described_class.new(work_package: work_package)+ expect(new_schema).to_not be_readonly+ expect(new_schema.writable?(:status)).to be_truthy+ expect(new_schema.writable?(:subject)).to be_truthyendend