ttaka66 8 лет назад
Родитель
Сommit
5ff070d326
2 измененных файлов с 3 добавлено и 3 удалено
  1. 3 2
      lib/models/page.js
  2. 0 1
      lib/routes/page.js

+ 3 - 2
lib/models/page.js

@@ -1028,17 +1028,18 @@ module.exports = function(crowi) {
   pageSchema.statics.renameRecursively = function(pageData, newPagePathPrefix, user, options) {
     var Page = this
       , path = pageData.path
-      , pathRegExp = new RegExp('^' + path, 'i')
+      , pathRegExp = new RegExp('^' + path, 'i');
 
     return new Promise(function(resolve, reject) {
       Page
       .generateQueryToListByStartWith(path, user, options)
       .then(function(pages) {
         Promise.all(pages.map(function(page) {
-          newPagePath = page.path.replace(pathRegExp, newPagePathPrefix)
+          newPagePath = page.path.replace(pathRegExp, newPagePathPrefix);
           return Page.rename(page, newPagePath, user, options);
         }))
         .then(function() {
+          pageData.path = newPagePathPrefix;
           return resolve();
         });
       });

+ 0 - 1
lib/routes/page.js

@@ -1096,7 +1096,6 @@ module.exports = function(crowi, app) {
         return Page.renameRecursively(pageData, newPagePath, req.user, options);
       }).then(function() {
         var result = {};
-        page.path = newPagePath
         result.page = page;
 
         return res.json(ApiResponse.success(result));