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

remove pageId on request as it is not used for now

yohei0125 3 лет назад
Родитель
Сommit
b3dcb5951f

+ 2 - 3
packages/app/src/server/routes/apiv3/pages.js

@@ -553,12 +553,11 @@ module.exports = (crowi) => {
 
   router.post('/resume-rename-operation', accessTokenParser, loginRequiredStrictly, csrf, apiV3FormValidator, async(req, res) => {
     try {
-      const { pageId } = req.body;
-      await crowi.pageService.resumeRenamePageOperation(req.user, pageId);
+      await crowi.pageService.resumeRenamePageOperation(req.user);
     }
     catch (err) {
       logger.error(err);
-      return res.apiv3Err(new ErrorV3('Failed to resume rename operation'), 500);
+      return res.apiv3Err(new ErrorV3(`Failed to resume rename operation. ${err}`), 500);
     }
     return res.apiv3();
   });

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

@@ -584,17 +584,11 @@ class PageService {
     await PageOperation.findByIdAndDelete(pageOpId);
   }
 
-  async resumeRenamePageOperation(user: any, pageId: ObjectIdLike): Promise<void> {
-
+  async resumeRenamePageOperation(user: any): Promise<void> {
     if (user == null) {
       throw Error('Guest user cannot execute this operation');
     }
 
-    const isExistPageOp = await PageOperation.exists({ 'page._id': pageId });
-    if (isExistPageOp == null || !isExistPageOp) {
-      throw Error('PageOperation is not found');
-    }
-
     const filter = { actionType: PageActionType.Rename, actionStage: PageActionStage.Sub };
     const pageOps = await PageOperation.find(filter);