2
0
Эх сурвалжийг харах

replace renameSubOperation with fixPathsAndDescendantCount

yohei0125 3 жил өмнө
parent
commit
1d5f4bd44c

+ 5 - 1
packages/app/src/server/service/page.ts

@@ -634,7 +634,11 @@ class PageService {
       page, fromPath, toPath, options, user,
       page, fromPath, toPath, options, user,
     } = pageOp;
     } = pageOp;
 
 
-    await this.renameSubOperation(page, toPath, user, options, renamedPage, pageOp._id);
+    this.fixPathsAndDescendantCount(page, user, options, renamedPage, pageOp._id, fromPath, toPath);
+  }
+
+  async fixPathsAndDescendantCount(page, user, options, renamedPage, pageOpId, fromPath, toPath): Promise<void> {
+    await this.renameSubOperation(page, toPath, user, options, renamedPage, pageOpId);
     const ancestorsPaths = this.crowi.pageOperationService.getAncestorsPathsByFromAndToPath(fromPath, toPath);
     const ancestorsPaths = this.crowi.pageOperationService.getAncestorsPathsByFromAndToPath(fromPath, toPath);
     await this.updateDescendantCountOfPagesWithPaths(ancestorsPaths);
     await this.updateDescendantCountOfPagesWithPaths(ancestorsPaths);
   }
   }