Преглед изворни кода

Merge branch 'feat/api-get-ancestors-children' into feat/pt-item-get-children

Taichi Masuyama пре 4 година
родитељ
комит
a722b6453f
1 измењених фајлова са 2 додато и 3 уклоњено
  1. 2 3
      packages/app/src/server/models/page.ts

+ 2 - 3
packages/app/src/server/models/page.ts

@@ -84,9 +84,7 @@ schema.plugin(uniqueValidator);
  * Methods
  * Methods
  */
  */
 const collectAncestorPaths = (path: string, ancestorPaths: string[] = []): string[] => {
 const collectAncestorPaths = (path: string, ancestorPaths: string[] = []): string[] => {
-  if (isTopPage(path)) {
-    return ancestorPaths;
-  }
+  if (isTopPage(path)) return ancestorPaths;
 
 
   const parentPath = nodePath.dirname(path);
   const parentPath = nodePath.dirname(path);
   ancestorPaths.push(parentPath);
   ancestorPaths.push(parentPath);
@@ -303,6 +301,7 @@ schema.statics.findAncestorsChildrenByPathAndViewer = async function(path: strin
     .query
     .query
     .lean()
     .lean()
     .exec();
     .exec();
+  // mark target
   const pages = _pages.map((page: PageDocument & {isTarget?: boolean}) => {
   const pages = _pages.map((page: PageDocument & {isTarget?: boolean}) => {
     if (page.path === path) {
     if (page.path === path) {
       page.isTarget = true;
       page.isTarget = true;