Yuki Takei 9 лет назад
Родитель
Сommit
d3af74727b
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      lib/routes/page.js

+ 9 - 0
lib/routes/page.js

@@ -751,6 +751,9 @@ module.exports = function(crowi, app) {
     var pageId = req.body.page_id;
     var previousRevision = req.body.revision_id || null;
 
+    // get completely flag
+    const isCompletely = (req.body.completely !== undefined);
+
     Page.findPageByIdAndGrantedUser(pageId, req.user)
     .then(function(pageData) {
       debug('Delete page', pageData._id, pageData.path);
@@ -758,6 +761,12 @@ module.exports = function(crowi, app) {
       if (!pageData.isUpdatable(previousRevision)) {
         throw new Error('Someone could update this page, so couldn\'t delete.');
       }
+
+      if (isCompletely) {
+        return Page.completelyDeletePage(pageData, req.user)
+          .then(() => pageData);
+      }
+      // else
       return Page.deletePage(pageData, req.user);
     }).then(function(data) {
       debug('Page deleted', data.path);