From 031b3985b03bf120fff8cb1822d0db34f77a94fa Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Wed, 18 Nov 2020 23:14:34 -0500 Subject: [PATCH] Fix for Issue 869 This excludes the local and avatar entities from what is returns by Entities.getChildrenIDs to avoid the selection tools of the Zone entities to be considered as Children of it. This was necessary for the display of the hierarchy status, but also for the "Add Children to Selection". --- scripts/system/create/edit.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/system/create/edit.js b/scripts/system/create/edit.js index 099cb94988..a8b829c551 100644 --- a/scripts/system/create/edit.js +++ b/scripts/system/create/edit.js @@ -2908,7 +2908,7 @@ function zoneSortOrder(a, b) { function getParentState(id) { var state = "NONE"; var properties = Entities.getEntityProperties(id, ["parentID"]); - var children = Entities.getChildrenIDs(id); + var children = getDomainOnlyChildrenIDs(id); if (properties.parentID !== Uuid.NULL) { if (children.length > 0) { state = "PARENT_CHILDREN"; @@ -2923,4 +2923,17 @@ function getParentState(id) { return state; } +function getDomainOnlyChildrenIDs(id) { + var allChildren = Entities.getChildrenIDs(id); + var domainOnlyChildren = []; + var properties; + for (var i = 0; i < allChildren.length; i++) { + properties = Entities.getEntityProperties(allChildren[i], ["entityHostType"]); + if (properties.entityHostType == "domain") { + domainOnlyChildren.push(allChildren[i]); + } + } + return domainOnlyChildren; +} + }()); // END LOCAL_SCOPE