Sfoglia il codice sorgente

Improved condition

Taichi Masuyama 4 anni fa
parent
commit
43b79c7579
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      packages/app/src/server/service/page.ts

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

@@ -858,8 +858,10 @@ class PageService {
     // v4 compatible process
     const isPageMigrated = page.parent != null;
     const isV5Compatible = this.crowi.configManager.getConfig('crowi', 'app:isV5Compatible');
-    const useV4Process = !isV5Compatible || !isPageMigrated;
-    if (useV4Process) {
+    const isRoot = isTopPage(page.path);
+    const isPageRestricted = page.grant === Page.GRANT_RESTRICTED;
+    const shouldUseV4Process = !isRoot && !isPageRestricted && (!isV5Compatible || !isPageMigrated);
+    if (shouldUseV4Process) {
       return this.deletePageV4(page, user, options, isRecursively);
     }