ryoji-s 2 lat temu
rodzic
commit
232e8deb40
1 zmienionych plików z 4 dodań i 3 usunięć
  1. 4 3
      apps/app/src/server/service/page.ts

+ 4 - 3
apps/app/src/server/service/page.ts

@@ -1987,16 +1987,17 @@ class PageService {
 
     let pageOp;
     try {
-      // Delete the user's homepage and ensure consistency of ancestors and leaf pages
-      const inc = userHomepage.isEmpty ? -userHomepage.descendantCount : -(userHomepage.descendantCount + 1);
-
       if (!shouldUseV4Process) {
+        // Ensure consistency of ancestors
+        const inc = userHomepage.isEmpty ? -userHomepage.descendantCount : -(userHomepage.descendantCount + 1);
         await this.updateDescendantCountOfAncestors(userHomepage.parent, inc, true);
       }
 
+      // Delete the user's homepage
       await this.deleteCompletelyOperation(ids, paths);
 
       if (!shouldUseV4Process) {
+        // Remove leaf empty pages
         await Page.removeLeafEmptyPagesRecursively(userHomepage.parent);
       }