diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-06-22 14:38:37 +0200 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-06-22 14:38:37 +0200 |
commit | d89dd24f2755d92fd87f96d9548b9a82ca316409 (patch) | |
tree | ca9082d9a7a619908a218b588d629a8be2176c32 | |
parent | 73fe7575b1964f0080afe075541f7f149228f645 (diff) | |
download | gitlab-ce-33675-keep-groups-sorted-as-expected.tar.gz |
Rephrased comments + removed unnecessary comments33675-keep-groups-sorted-as-expected
-rw-r--r-- | app/assets/javascripts/groups/stores/groups_store.js | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/app/assets/javascripts/groups/stores/groups_store.js b/app/assets/javascripts/groups/stores/groups_store.js index dcf582b6900..6eab6083e8f 100644 --- a/app/assets/javascripts/groups/stores/groups_store.js +++ b/app/assets/javascripts/groups/stores/groups_store.js @@ -63,9 +63,7 @@ export default class GroupsStore { } else if (parentGroup && parentGroup.id === currentGroup.parentId) { tree[`id${currentGroup.id}`] = currentGroup; } else { - // No parent found. We save it for later processing. - // We should put it inside a group where it's contained. - // e.g. If this group is `one / two / three` we are going to put it inside `one` + // No parent found. We save it for later processing orphans.push(currentGroup); // Add to tree to preserve original order @@ -79,7 +77,6 @@ export default class GroupsStore { return key; }); - // Hopefully this array will be empty for most cases if (orphans.length) { orphans.map((orphan) => { let found = false; @@ -89,11 +86,10 @@ export default class GroupsStore { const group = tree[key]; if ( - // Make sure `group` exists since it can be deleted below group && currentOrphan.fullPath.lastIndexOf(group.fullPath) === 0 && - // Make sure is not the same we are not comparing the same group. - // If we don't do this it will cause and infinite loop when rendering on vue + // Make sure the currently selected orphan is not the same as the group + // we are checking here otherwise it will end up in an infinite loop currentOrphan.id !== group.id ) { group.subGroups[currentOrphan.id] = currentOrphan; |