Explorar o código

update revision

itizawa %!s(int64=5) %!d(string=hai) anos
pai
achega
5dd3d2f2e5
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      src/server/service/page.js

+ 4 - 0
src/server/service/page.js

@@ -211,6 +211,8 @@ class PageService {
 
   async deletePage(page, user, options = {}, isRecursively = false) {
     const Page = this.crowi.model('Page');
+    const Revision = this.crowi.model('Revision');
+
     const newPath = Page.getDeletedPageName(page.path);
     const isTrashed = isTrashPage(page.path);
 
@@ -227,6 +229,8 @@ class PageService {
       this.deleteDescendantsWithStream(page, user, options);
     }
 
+    // update Rivisions
+    await Revision.updateRevisionListByPath(page.path, { path: newPath }, {});
     const deletedPage = await Page.findByIdAndUpdate(page._id, { $set: { path: newPath, status: Page.STATUS_DELETED } }, { new: true });
     const body = `redirect ${newPath}`;
     await Page.create(page.path, body, user, { redirectTo: newPath });