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 label check when not changing the label
Bruno Pagno6fceb3919968
diff --git a/app/contracts/custom_fields/hierarchy/update_item_contract.rb b/app/contracts/custom_fields/hierarchy/update_item_contract.rbindex b78f45369eb..e3d139bdcc4 100644--- a/app/contracts/custom_fields/hierarchy/update_item_contract.rb+++ b/app/contracts/custom_fields/hierarchy/update_item_contract.rb@@ -45,7 +45,12 @@ module CustomFieldsrule(:label) donext unless key?- if CustomField::Hierarchy::Item.exists?(parent_id: values[:item].parent_id, label: value)+ label_already_exists = CustomField::Hierarchy::Item+ .where(parent_id: values[:item].parent_id, label: value)+ .where.not(id: values[:item].id)+ .exists?++ if label_already_existskey.failure("must be unique at the same hierarchical level")endenddiff --git a/spec/contracts/custom_fields/hierarchy/update_item_contract_spec.rb b/spec/contracts/custom_fields/hierarchy/update_item_contract_spec.rbindex eef698f8447..53011a43046 100644--- a/spec/contracts/custom_fields/hierarchy/update_item_contract_spec.rb+++ b/spec/contracts/custom_fields/hierarchy/update_item_contract_spec.rb@@ -49,6 +49,7 @@ RSpec.describe CustomFields::Hierarchy::UpdateItemContract do[{ item: luke, label: "Luke Skywalker", short: "LS" },{ item: luke, label: "Luke Skywalker" },+ { item: luke, label: "luke", short: "lu" },{ item: luke, short: "LS" },{ item: luke, short: "lo" },{ item: luke }