Browse Source

remove futile code

yohei0125 4 years ago
parent
commit
f887796244
1 changed files with 1 additions and 3 deletions
  1. 1 3
      packages/app/src/server/models/page.ts

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

@@ -957,9 +957,7 @@ export function generateGrantCondition(
 schema.statics.generateGrantCondition = generateGrantCondition;
 
 schema.statics.findNotEmptyClosestAncestor = async function(path: string): Promise<PageDocument> {
-  const Page = mongoose.model('Page') as unknown as PageModel;
-  const { PageQueryBuilder } = Page;
-  const builderForAncestors = new PageQueryBuilder(Page.find(), false); // empty page not included
+  const builderForAncestors = new PageQueryBuilder(this.find(), false); // empty page not included
 
   const ancestors = await builderForAncestors
     .addConditionToListOnlyAncestors(path) // only ancestor paths