Bläddra i källkod

modify restartPageRenameOperation

yohei0125 4 år sedan
förälder
incheckning
36d74dda60
1 ändrade filer med 2 tillägg och 5 borttagningar
  1. 2 5
      packages/app/src/server/service/page.ts

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

@@ -563,17 +563,14 @@ class PageService {
 
   async restartPageRenameOperation(pageId: ObjectIdLike): Promise<void> {
     const filter = { 'page.id': pageId, actionType: PageActionType.Rename, isFailure: true };
-    const update = { isFailure: false };
-    const option = { new: true };
+    const update = { isFailure: false, actionStage: PageActionStage.Main }; // as it restarts from the beginning
     // find one, update it, and return the updated document
-    const pageOp = await PageOperation.findOneAndUpdate(filter, update, option); // set isFailure to false before rename operation
+    const pageOp = await PageOperation.findOneAndUpdate(filter, update, { new: true }); // set isFailure to false before rename operation
 
     if (pageOp == null || pageOp.toPath == null) {
       throw Error('PageRenameOperation cannot be restarted as PageOperation to be processed is not found');
     }
 
-    pageOp.actionStage = PageActionStage.Main; // to restart from the beginning
-
     const {
       page, toPath, user, options, _id,
     } = pageOp;