Taichi Masuyama 4 лет назад
Родитель
Сommit
ec8123c553
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      packages/app/src/server/models/page.ts

+ 9 - 0
packages/app/src/server/models/page.ts

@@ -1139,6 +1139,15 @@ export default (crowi: Crowi): any => {
     }
 
     if (isExRestricted && grant !== GRANT_RESTRICTED) {
+      const emptyPageAtSamePath = await this.findOne({ path: pageData.path, isEmpty: true });
+
+      if (emptyPageAtSamePath != null) {
+        // Update children's parent with new parent
+        await this.updateMany(
+          { parent: emptyPageAtSamePath._id },
+          { parent: savedPage._id },
+        );
+      }
       await this.findOneAndDelete({ path: pageData.path, isEmpty: true });
     }