Taichi Masuyama 4 лет назад
Родитель
Сommit
fcec29100c

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

@@ -744,7 +744,7 @@ class PageService {
     const Page = mongoose.model('Page') as unknown as PageModel;
     const PageTagRelation = mongoose.model('PageTagRelation') as any; // TODO: Typescriptize model
 
-    if (isRecursively && page.isEmpty) {
+    if (!isRecursively && page.isEmpty) {
       throw Error('Page not found.');
     }
 
@@ -803,6 +803,7 @@ class PageService {
       duplicatedTarget = await Page.createEmptyPage(newPagePath, parent);
     }
     else {
+      console.log('ははははh?', page);
       // copy & populate (reason why copy: SubOperation only allows non-populated page document)
       const copyPage = { ...page };
       await copyPage.populate({ path: 'revision', model: 'Revision', select: 'body' });

+ 2 - 2
packages/app/test/integration/service/v5.page.test.ts

@@ -1294,7 +1294,7 @@ describe('PageService page operations with only public pages', () => {
       mockedCreateAndSendNotifications.mockRestore();
 
       if (isRecursively) {
-        await crowi.pageService.resumableDeleteCompletelyDescendants(...argsForDeleteCompletelyRecursivelyMainOperation);
+        await crowi.pageService.deleteCompletelyRecursivelyMainOperation(...argsForDeleteCompletelyRecursivelyMainOperation);
       }
 
       return;
@@ -1411,7 +1411,7 @@ describe('PageService page operations with only public pages', () => {
       // restores the original implementation
       mockedRevertRecursivelyMainOperation.mockRestore();
       if (isRecursively) {
-        await crowi.pageService.resumableRevertDeletedDescendants(...argsForRecursivelyMainOperation);
+        await crowi.pageService.revertRecursivelyMainOperation(...argsForRecursivelyMainOperation);
       }
 
       return revertedPage;