Просмотр исходного кода

Merge pull request #7982 from weseek/dev/6.1.x

Release v6.1.12
Yuki Takei 2 лет назад
Родитель
Сommit
1e2ad0a6db

+ 1 - 1
.github/workflows/draft-release.yml

@@ -68,7 +68,7 @@ jobs:
         uses: bakunyo/git-pr-release-action@master
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          GIT_PR_RELEASE_BRANCH_PRODUCTION: release/current
+          GIT_PR_RELEASE_BRANCH_PRODUCTION: release/${{ github.ref_name == 'master' && 'current' || steps.release-version.outputs.RELEASE_VERSION }}
           GIT_PR_RELEASE_BRANCH_STAGING: ${{ github.ref_name }}
           GIT_PR_RELEASE_TEMPLATE: .github/git-pr-release-template.erb
           GIT_PR_RELEASE_TITLE: Release v${{ steps.release-version.outputs.RELEASE_VERSION }}

+ 1 - 1
apps/app/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/app",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "license": "MIT",
   "scripts": {
     "//// for production": "",

+ 1 - 1
apps/app/src/components/ReactMarkdownComponents/LightBox.tsx

@@ -6,7 +6,7 @@ export const LightBox = (props) => {
   const [toggler, setToggler] = useState(false);
   return (
     <>
-      <img src={props.src} alt={props.alt} onClick={() => setToggler(!toggler)}/>
+      <img {...props.node.properties} onClick={() => setToggler(!toggler)}/>
       <FsLightbox
         toggler={toggler}
         sources={[props.src]}

+ 2 - 2
apps/app/src/server/routes/apiv3/pages.js

@@ -529,7 +529,7 @@ module.exports = (crowi) => {
     // check whether path starts slash
     newPagePath = pathUtils.addHeadingSlash(newPagePath);
 
-    const isExist = await Page.count({ path: newPagePath }) > 0;
+    const isExist = await Page.exists({ path: newPagePath, isEmpty: false });
     if (isExist) {
       // if page found, cannot rename to that path
       return res.apiv3Err(new ErrorV3(`${newPagePath} already exists`, 'already_exists'), 409);
@@ -760,7 +760,7 @@ module.exports = (crowi) => {
       }
 
       // check page existence
-      const isExist = (await Page.count({ path: newPagePath })) > 0;
+      const isExist = (await Page.exists({ path: newPagePath, isEmpty: false }));
       if (isExist) {
         return res.apiv3Err(new ErrorV3(`Page exists '${newPagePath})'`, 'already_exists'), 409);
       }

+ 1 - 1
apps/app/src/server/service/page.ts

@@ -374,7 +374,7 @@ class PageService {
 
     const activity = await this.crowi.activityService.createActivity(parameters);
 
-    const isExist = await Page.exists({ path: newPagePath });
+    const isExist = await Page.exists({ path: newPagePath, isEmpty: false });
     if (isExist) {
       throw Error(`Page already exists at ${newPagePath}`);
     }

+ 75 - 10
apps/app/test/integration/service/v5.public-page.test.ts

@@ -135,9 +135,13 @@ describe('PageService page operations with only public pages', () => {
     const pageIdForRename9 = new mongoose.Types.ObjectId();
     const pageIdForRename10 = new mongoose.Types.ObjectId();
     const pageIdForRename11 = new mongoose.Types.ObjectId();
-    const pageIdForRename12 = new mongoose.Types.ObjectId();
-    const pageIdForRename13 = new mongoose.Types.ObjectId();
-    const pageIdForRename14 = new mongoose.Types.ObjectId();
+
+    const childPageIdForRename1 = new mongoose.Types.ObjectId();
+    const childPageIdForRename2 = new mongoose.Types.ObjectId();
+    const childPageIdForRename3 = new mongoose.Types.ObjectId();
+    const childPageIdForRename4 = new mongoose.Types.ObjectId();
+    const childPageIdForRename5 = new mongoose.Types.ObjectId();
+    const childPageIdForRename7 = new mongoose.Types.ObjectId();
 
     const pageIdForRename16 = new mongoose.Types.ObjectId();
 
@@ -235,7 +239,7 @@ describe('PageService page operations with only public pages', () => {
       },
       {
         _id: pageIdForRename10,
-        path: '/v5_ChildForRename1',
+        path: '/v5_ParentForRename10',
         grant: Page.GRANT_PUBLIC,
         creator: dummyUser1,
         lastUpdateUser: dummyUser1._id,
@@ -243,6 +247,23 @@ describe('PageService page operations with only public pages', () => {
       },
       {
         _id: pageIdForRename11,
+        path: '/v5_ParentForRename11',
+        grant: Page.GRANT_PUBLIC,
+        creator: dummyUser1,
+        lastUpdateUser: dummyUser1._id,
+        parent: rootPage._id,
+        isEmpty: true,
+      },
+      {
+        _id: childPageIdForRename1,
+        path: '/v5_ChildForRename1',
+        grant: Page.GRANT_PUBLIC,
+        creator: dummyUser1,
+        lastUpdateUser: dummyUser1._id,
+        parent: rootPage._id,
+      },
+      {
+        _id: childPageIdForRename2,
         path: '/v5_ChildForRename2',
         grant: Page.GRANT_PUBLIC,
         creator: dummyUser1,
@@ -250,7 +271,7 @@ describe('PageService page operations with only public pages', () => {
         parent: rootPage._id,
       },
       {
-        _id: pageIdForRename12,
+        _id: childPageIdForRename3,
         path: '/v5_ChildForRename3',
         grant: Page.GRANT_PUBLIC,
         creator: dummyUser1,
@@ -259,7 +280,7 @@ describe('PageService page operations with only public pages', () => {
         updatedAt: new Date('2021'),
       },
       {
-        _id: pageIdForRename13,
+        _id: childPageIdForRename4,
         path: '/v5_ChildForRename4',
         grant: Page.GRANT_PUBLIC,
         creator: dummyUser1,
@@ -267,7 +288,7 @@ describe('PageService page operations with only public pages', () => {
         parent: rootPage._id,
       },
       {
-        _id: pageIdForRename14,
+        _id: childPageIdForRename5,
         path: '/v5_ChildForRename5',
         grant: Page.GRANT_PUBLIC,
         creator: dummyUser1,
@@ -275,7 +296,7 @@ describe('PageService page operations with only public pages', () => {
         parent: rootPage._id,
       },
       {
-        _id: pageIdForRename16,
+        _id: childPageIdForRename7,
         path: '/v5_ChildForRename7',
         grant: Page.GRANT_PUBLIC,
         parent: rootPage._id,
@@ -286,7 +307,7 @@ describe('PageService page operations with only public pages', () => {
         grant: Page.GRANT_PUBLIC,
         creator: dummyUser1,
         lastUpdateUser: dummyUser1._id,
-        parent: pageIdForRename14,
+        parent: childPageIdForRename5,
         updatedAt: new Date('2021'),
       },
       {
@@ -294,7 +315,7 @@ describe('PageService page operations with only public pages', () => {
         grant: Page.GRANT_PUBLIC,
         creator: dummyUser1,
         lastUpdateUser: dummyUser1._id,
-        parent: pageIdForRename16,
+        parent: childPageIdForRename7,
       },
       {
         _id: pageIdForRename17,
@@ -470,6 +491,7 @@ describe('PageService page operations with only public pages', () => {
     const pageIdForDuplicate13 = new mongoose.Types.ObjectId();
     const pageIdForDuplicate14 = new mongoose.Types.ObjectId();
     const pageIdForDuplicate15 = new mongoose.Types.ObjectId();
+    const pageIdForDuplicate16 = new mongoose.Types.ObjectId();
 
     // revision ids
     const revisionIdForDuplicate1 = new mongoose.Types.ObjectId();
@@ -606,6 +628,13 @@ describe('PageService page operations with only public pages', () => {
         parent: pageIdForDuplicate14,
         revision: revisionIdForDuplicate12,
       },
+      {
+        _id: pageIdForDuplicate16,
+        path: '/v5_PageForDuplicate16',
+        grant: Page.GRANT_PUBLIC,
+        parent: rootPage._id,
+        isEmpty: true,
+      },
     ]);
 
     await Revision.insertMany([
@@ -1370,6 +1399,24 @@ describe('PageService page operations with only public pages', () => {
 
       expect(isThrown).toBe(true);
     });
+    test('Should rename/move to the path that exists as an empty page', async() => {
+      const page = await Page.findOne({ path: '/v5_ParentForRename10' });
+      const pageDistination = await Page.findOne({ path: '/v5_ParentForRename11', isEmpty: true });
+      expect(page).toBeTruthy();
+      expect(pageDistination).toBeTruthy();
+      expect(pageDistination.isEmpty).toBe(true);
+
+      const newPath = '/v5_ParentForRename11';
+      const renamedPage = await renamePage(page, newPath, dummyUser1, {}, {
+        ip: '::ffff:127.0.0.1',
+        endpoint: '/_api/v3/pages/rename',
+      });
+
+      expect(xssSpy).toHaveBeenCalled();
+      expect(renamedPage.path).toBe(newPath);
+      expect(renamedPage.isEmpty).toBe(false);
+      expect(renamedPage._id).toStrictEqual(page._id);
+    });
     test('Rename non-empty page path to its descendant non-empty page path', async() => {
       const initialPathForPage1 = '/v5_pageForRename17';
       const initialPathForPage2 = '/v5_pageForRename17/v5_pageForRename18';
@@ -1696,6 +1743,24 @@ describe('PageService page operations with only public pages', () => {
       expect(isThrown).toBe(true);
     });
 
+    test('Should duplicate to the path that exists as an empty page', async() => {
+      const page = await Page.findOne({ path: '/v5_PageForDuplicate1' });
+      expect(page).toBeTruthy();
+
+      const newPagePath = '/v5_PageForDuplicate16';
+      const duplicatedPage = await duplicate(page, newPagePath, dummyUser1, false);
+
+      const duplicatedRevision = await Revision.findOne({ pageId: duplicatedPage._id });
+      const baseRevision = await Revision.findOne({ pageId: page._id });
+
+      // new path
+      expect(xssSpy).toHaveBeenCalled();
+      expect(duplicatedPage.path).toBe(newPagePath);
+      expect(duplicatedPage._id).not.toStrictEqual(page._id);
+      expect(duplicatedPage.revision).toStrictEqual(duplicatedRevision._id);
+      expect(duplicatedRevision.body).toEqual(baseRevision.body);
+    });
+
     test('Should duplicate multiple pages', async() => {
       const basePage = await Page.findOne({ path: '/v5_PageForDuplicate3' });
       const revision = await Revision.findOne({ pageId: basePage._id });

+ 1 - 1
apps/slackbot-proxy/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/slackbot-proxy",
-  "version": "6.1.11-slackbot-proxy.0",
+  "version": "6.1.12-slackbot-proxy.0",
   "license": "MIT",
   "scripts": {
     "build": "yarn tsc && tsc-alias -p tsconfig.build.json",

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "growi",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "description": "Team collaboration software using markdown",
   "tags": [
     "wiki",

+ 1 - 1
packages/core/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/core",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "description": "GROWI Core Libraries",
   "license": "MIT",
   "keywords": [

+ 1 - 1
packages/hackmd/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/hackmd",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "description": "GROWI js and css files to use hackmd",
   "license": "MIT",
   "type": "module",

+ 1 - 1
packages/presentation/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/presentation",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "description": "GROWI plugin for presentation",
   "license": "MIT",
   "keywords": [

+ 1 - 1
packages/preset-templates/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/preset-templates",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "scripts": {
     "test": "vitest run",
     "version": "yarn version --no-git-tag-version --preid=RC"

+ 1 - 1
packages/preset-themes/package.json

@@ -1,7 +1,7 @@
 {
   "name": "@growi/preset-themes",
   "description": "GROWI preset themes",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "license": "MIT",
   "main": "dist/libs/preset-themes.umd.js",
   "module": "dist/libs/preset-themes.mjs",

+ 1 - 1
packages/remark-attachment-refs/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/remark-attachment-refs",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "description": "GROWI Plugin to add ref/refimg/refs/refsimg tags",
   "license": "MIT",
   "keywords": [

+ 1 - 1
packages/remark-drawio/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/remark-drawio",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "description": "remark plugin to draw diagrams with draw.io (diagrams.net)",
   "license": "MIT",
   "keywords": [

+ 1 - 1
packages/remark-growi-directive/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/remark-growi-directive",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "description": "remark plugin to support GROWI plugin (forked from remark-directive@2.0.1)",
   "license": "MIT",
   "keywords": [

+ 1 - 1
packages/remark-lsx/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/remark-lsx",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "description": "GROWI plugin to list pages",
   "license": "MIT",
   "keywords": [

+ 1 - 1
packages/slack/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/slack",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "license": "MIT",
   "main": "dist/index.js",
   "module": "dist/index.mjs",

+ 1 - 1
packages/ui/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@growi/ui",
-  "version": "6.1.11",
+  "version": "6.1.12-RC.0",
   "description": "GROWI UI Libraries",
   "license": "MIT",
   "keywords": [

+ 11 - 11
yarn.lock

@@ -2495,13 +2495,13 @@
     xdg-basedir "^4.0.0"
 
 "@growi/core@link:packages/core":
-  version "6.1.11"
+  version "6.1.12-RC.0"
   dependencies:
     bson-objectid "^2.0.4"
     escape-string-regexp "^4.0.0"
 
 "@growi/hackmd@link:packages/hackmd":
-  version "6.1.11"
+  version "6.1.12-RC.0"
 
 "@growi/pluginkit@link:packages/pluginkit":
   version "0.1.0"
@@ -2510,18 +2510,18 @@
     extensible-custom-error "^0.0.7"
 
 "@growi/presentation@link:packages/presentation":
-  version "6.1.11"
+  version "6.1.12-RC.0"
   dependencies:
     "@growi/core" "link:packages/core"
 
 "@growi/preset-templates@link:packages/preset-templates":
-  version "6.1.11"
+  version "6.1.12-RC.0"
 
 "@growi/preset-themes@link:packages/preset-themes":
-  version "6.1.11"
+  version "6.1.12-RC.0"
 
 "@growi/remark-attachment-refs@link:packages/remark-attachment-refs":
-  version "6.1.11"
+  version "6.1.12-RC.0"
   dependencies:
     "@growi/core" "link:packages/core"
     "@growi/remark-growi-directive" "link:packages/remark-growi-directive"
@@ -2530,12 +2530,12 @@
     universal-bunyan "^0.9.2"
 
 "@growi/remark-drawio@link:packages/remark-drawio":
-  version "6.1.11"
+  version "6.1.12-RC.0"
   dependencies:
     pako "^2.1.0"
 
 "@growi/remark-growi-directive@link:packages/remark-growi-directive":
-  version "6.1.11"
+  version "6.1.12-RC.0"
   dependencies:
     "@types/mdast" "^3.0.0"
     "@types/unist" "^2.0.0"
@@ -2552,7 +2552,7 @@
     uvu "^0.5.0"
 
 "@growi/remark-lsx@link:packages/remark-lsx":
-  version "6.1.11"
+  version "6.1.12-RC.0"
   dependencies:
     "@growi/core" "link:packages/core"
     "@growi/remark-growi-directive" "link:packages/remark-growi-directive"
@@ -2563,7 +2563,7 @@
     swr "^2.0.3"
 
 "@growi/slack@link:packages/slack":
-  version "6.1.11"
+  version "6.1.12-RC.0"
   dependencies:
     "@slack/oauth" "^2.0.1"
     axios "^0.24.0"
@@ -2576,7 +2576,7 @@
     url-join "^4.0.0"
 
 "@growi/ui@link:packages/ui":
-  version "6.1.11"
+  version "6.1.12-RC.0"
   dependencies:
     "@growi/core" "link:packages/core"