Parcourir la source

Merge branch 'feat/duplicate-with-subordinate-page' into feat/gw-4187

itizawa il y a 5 ans
Parent
commit
090b24429d
2 fichiers modifiés avec 6 ajouts et 9 suppressions
  1. 6 6
      src/server/routes/apiv3/pages.js
  2. 0 3
      src/server/routes/page.js

+ 6 - 6
src/server/routes/apiv3/pages.js

@@ -119,7 +119,7 @@ module.exports = (crowi) => {
   const globalNotificationService = crowi.getGlobalNotificationService();
   const userNotificationService = crowi.getUserNotificationService();
 
-  const { pageService } = crowi;
+  const { serializePageSecurely } = require('../../models/serializers/page-serializer');
 
   const validator = {
     createPage: [
@@ -230,7 +230,7 @@ module.exports = (crowi) => {
 
     const savedTags = await saveTagsAction({ createdPage, pageTags });
 
-    const result = { page: pageService.serializeToObj(createdPage), tags: savedTags };
+    const result = { page: serializePageSecurely(createdPage), tags: savedTags };
 
     // update scopes for descendants
     if (overwriteScopesOfDescendants) {
@@ -404,7 +404,7 @@ module.exports = (crowi) => {
       return res.apiv3Err(new ErrorV3('Failed to update page.', 'unknown'), 500);
     }
 
-    const result = { page: pageService.serializeToObj(page) };
+    const result = { page: serializePageSecurely(page) };
 
     try {
       // global notification
@@ -499,7 +499,7 @@ module.exports = (crowi) => {
       logger.error('Create grobal notification failed', err);
     }
 
-    return { page: pageService.serializeToObj(createdPage), tags: savedTags };
+    return { page: serializePageSecurely(createdPage), tags: savedTags };
   }
 
   async function duplicatePageRecursively(page, newPagePath, user) {
@@ -556,7 +556,7 @@ module.exports = (crowi) => {
    *            description: Internal server error.
    */
   router.post('/duplicate', accessTokenParser, loginRequiredStrictly, csrf, validator.duplicatePage, apiV3FormValidator, async(req, res) => {
-    const { pageId, isRecursively } = req.body;
+    const { pageId, isDuplicateRecursively } = req.body;
 
     const newPagePath = pathUtils.normalizePath(req.body.pageNameInput);
 
@@ -577,7 +577,7 @@ module.exports = (crowi) => {
 
     let result;
 
-    if (isRecursively) {
+    if (isDuplicateRecursively) {
       result = await duplicatePageRecursively(page, newPagePath, req.user);
     }
     else {

+ 0 - 3
src/server/routes/page.js

@@ -1248,8 +1248,6 @@ module.exports = function(crowi, app) {
   /**
    * @swagger
    *
-<<<<<<< HEAD
-=======
    *    /pages.rename:
    *      post:
    *        tags: [Pages, CrowiCompatibles]
@@ -1373,7 +1371,6 @@ module.exports = function(crowi, app) {
   /**
    * @swagger
    *
->>>>>>> master
    *    /pages.duplicate:
    *      post:
    *        tags: [Pages]