Просмотр исходного кода

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

Taichi Masuyama 4 лет назад
Родитель
Сommit
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
  */
 const collectAncestorPaths = (path: string, ancestorPaths: string[] = []): string[] => {
-  if (isTopPage(path)) {
-    return ancestorPaths;
-  }
+  if (isTopPage(path)) return ancestorPaths;
 
   const parentPath = nodePath.dirname(path);
   ancestorPaths.push(parentPath);
@@ -303,6 +301,7 @@ schema.statics.findAncestorsChildrenByPathAndViewer = async function(path: strin
     .query
     .lean()
     .exec();
+  // mark target
   const pages = _pages.map((page: PageDocument & {isTarget?: boolean}) => {
     if (page.path === path) {
       page.isTarget = true;