Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-10-19 15:57:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-10-19 15:57:54 +0300
commit419c53ec62de6e97a517abd5fdd4cbde3a942a34 (patch)
tree1f43a548b46bca8a5fb8fe0c31cef1883d49c5b6 /app/models/work_items/parent_link.rb
parent1da20d9135b3ad9e75e65b028bffc921aaf8deb7 (diff)
Add latest changes from gitlab-org/gitlab@16-5-stable-eev16.5.0-rc42
Diffstat (limited to 'app/models/work_items/parent_link.rb')
-rw-r--r--app/models/work_items/parent_link.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/app/models/work_items/parent_link.rb b/app/models/work_items/parent_link.rb
index ea7755b03b4..32232c93d11 100644
--- a/app/models/work_items/parent_link.rb
+++ b/app/models/work_items/parent_link.rb
@@ -15,7 +15,6 @@ module WorkItems
validates :work_item, presence: true, uniqueness: true
validate :validate_hierarchy_restrictions
validate :validate_cyclic_reference
- validate :validate_same_project
validate :validate_max_children
validate :validate_confidentiality
validate :check_existing_related_link
@@ -50,14 +49,6 @@ module WorkItems
private
- def validate_same_project
- return if work_item.nil? || work_item_parent.nil?
-
- if work_item.resource_parent != work_item_parent.resource_parent
- errors.add :work_item_parent, _('parent must be in the same project as child.')
- end
- end
-
def validate_max_children
return unless work_item_parent
@@ -88,6 +79,14 @@ module WorkItems
end
validate_depth(restriction.maximum_depth)
+ validate_cross_hierarchy(restriction.cross_hierarchy_enabled)
+ end
+
+ def validate_cross_hierarchy(cross_hierarchy_enabled)
+ return if cross_hierarchy_enabled
+ return if work_item.resource_parent == work_item_parent.resource_parent
+
+ errors.add :work_item_parent, _('parent must be in the same project or group as child.')
end
def validate_depth(depth)