itizawa 5 years ago
parent
commit
d3a39bb14d
2 changed files with 3 additions and 3 deletions
  1. 2 2
      src/server/models/page.js
  2. 1 1
      src/server/service/page.js

+ 2 - 2
src/server/models/page.js

@@ -717,7 +717,7 @@ module.exports = function(crowi) {
    * find pages that is match with `path` and its descendants whitch user is able to manage
    */
   pageSchema.statics.findManageableListWithDescendants = async function(page, user, option = {}) {
-    const excludeParent = option.excludeParent || false;
+    const onlyDescendants = option.onlyDescendants || false;
 
     if (user == null) {
       return null;
@@ -725,7 +725,7 @@ module.exports = function(crowi) {
 
     const builder = new PageQueryBuilder(this.find());
 
-    if (excludeParent) {
+    if (onlyDescendants) {
       builder.addConditionToListOnlyDescendants(page.path, option);
     }
     else {

+ 1 - 1
src/server/service/page.js

@@ -84,7 +84,7 @@ class PageService {
     const Revision = this.crowi.model('Revision');
     const newPagePathPrefix = newPagePath;
     const pathRegExp = new RegExp(`^${escapeStringRegexp(page.path)}`, 'i');
-    const pages = await Page.findManageableListWithDescendants(page, user, { excludeParent: true });
+    const pages = await Page.findManageableListWithDescendants(page, user, { onlyDescendants: true });
     const revisions = await Revision.find({ path: pathRegExp });
 
     // Mapping to set to the body of the new revision