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

Merge branch 'master' into feat/growi-bot

itizawa 5 лет назад
Родитель
Сommit
16fc0ce3f7
4 измененных файлов с 245 добавлено и 75 удалено
  1. 54 74
      README.md
  2. 148 0
      README_JP.md
  3. 40 0
      src/migrations/2021042016038-convert-double-to-date.js
  4. 3 1
      src/server/service/page.js

+ 54 - 74
README.md

@@ -1,3 +1,5 @@
+- [日本語 🇯🇵](./README_JP.md)
+
 <p align="center">
 <p align="center">
   <a href="https://growi.org">
   <a href="https://growi.org">
     <img src="https://user-images.githubusercontent.com/1638767/38254268-d4476bbe-3793-11e8-964c-8865d690baff.png" width="240px">
     <img src="https://user-images.githubusercontent.com/1638767/38254268-d4476bbe-3793-11e8-964c-8865d690baff.png" width="240px">
@@ -12,52 +14,46 @@
   <a href="https://docs.growi.org">Documentation</a> / <a href="https://demo.growi.org">Demo</a>
   <a href="https://docs.growi.org">Documentation</a> / <a href="https://demo.growi.org">Demo</a>
 </p>
 </p>
 
 
-
-GROWI
-===========
+# GROWI
 
 
 [![Actions Status](https://github.com/weseek/growi/workflows/Node%20CI/badge.svg)](https://github.com/weseek/growi/actions)
 [![Actions Status](https://github.com/weseek/growi/workflows/Node%20CI/badge.svg)](https://github.com/weseek/growi/actions)
 [![dependencies status](https://david-dm.org/weseek/growi.svg)](https://david-dm.org/weseek/growi)
 [![dependencies status](https://david-dm.org/weseek/growi.svg)](https://david-dm.org/weseek/growi)
 [![devDependencies Status](https://david-dm.org/weseek/growi/dev-status.svg)](https://david-dm.org/weseek/growi?type=dev)
 [![devDependencies Status](https://david-dm.org/weseek/growi/dev-status.svg)](https://david-dm.org/weseek/growi?type=dev)
 [![docker pulls](https://img.shields.io/docker/pulls/weseek/growi.svg)](https://hub.docker.com/r/weseek/growi/)
 [![docker pulls](https://img.shields.io/docker/pulls/weseek/growi.svg)](https://hub.docker.com/r/weseek/growi/)
 
 
-| demonstration |
-| :-: |
-|![sample image](https://user-images.githubusercontent.com/42988650/70600974-6b29cc80-1c34-11ea-94ef-33c39c6a00dc.gif)|
+|                                                     demonstration                                                     |
+| :-------------------------------------------------------------------------------------------------------------------: |
+| ![sample image](https://user-images.githubusercontent.com/42988650/70600974-6b29cc80-1c34-11ea-94ef-33c39c6a00dc.gif) |
 
 
-Table Of Contents
----------------
+## Table Of Contents
 
 
 - [Features](#features)
 - [Features](#features)
 - [Quick Start for Production](#quick-start-for-production)
 - [Quick Start for Production](#quick-start-for-production)
-    - [docker-compose](#docker-compose)
-    - [Helm (Experimental)](#helm-experimental)
-    - [On-premise](#on-premise)
+  - [docker-compose](#docker-compose)
+  - [Helm (Experimental)](#helm-experimental)
+  - [On-premise](#on-premise)
 - [Environment Variables](#environment-variables)
 - [Environment Variables](#environment-variables)
 - [Documentation](#documentation)
 - [Documentation](#documentation)
 - [License](#license)
 - [License](#license)
 
 
-Features
-========
-
-* **Features**
-    * Create hierarchical pages with markdown -> [HERE](https://docs.growi.org/en/guide/getting-started/five_minutes.html) is 5 minutes tutorial
-    * Simultaneously edit with multiple people by [HackMD(CodiMD)](https://hackmd.io/) integration
-        * [GROWI Docs: HackMD(CodiMD) Integration](https://docs.growi.org/en/admin-guide/admin-cookbook/integrate-with-hackmd.html)
-    * Support Authentication with LDAP / Active Directory, OAuth
-    * SSO(Single Sign On) with SAML
-    * Slack/Mattermost, IFTTT Integration
-    * [GROWI Docs: Features](https://docs.growi.org/en/guide/features/page_layout.html)
-* **Pluggable**
-    * You can find plugins from [npm](https://www.npmjs.com/browse/keyword/growi-plugin) or [github](https://github.com/search?q=topic%3Agrowi-plugin)!
-* **[Docker Ready][dockerhub]**
-* **[Docker Compose Ready][docker-compose]**
-    * [GROWI Docs: Multiple sites](https://docs.growi.org/en/admin-guide/admin-cookbook/multi-app.html)
-    * [GROWI Docs: HTTPS(with Let's Encrypt) proxy integration](https://docs.growi.org/en/admin-guide/admin-cookbook/lets-encrypt.html)
-
-Quick Start for Production
-===========================
-
+# Features
+
+- **Features**
+  - Create hierarchical pages with markdown -> [HERE](https://docs.growi.org/en/guide/getting-started/five_minutes.html) is 5 minutes tutorial
+  - Simultaneously edit with multiple people by [HackMD(CodiMD)](https://hackmd.io/) integration
+    - [GROWI Docs: HackMD(CodiMD) Integration](https://docs.growi.org/en/admin-guide/admin-cookbook/integrate-with-hackmd.html)
+  - Support Authentication with LDAP / Active Directory, OAuth
+  - SSO(Single Sign On) with SAML
+  - Slack/Mattermost, IFTTT Integration
+  - [GROWI Docs: Features](https://docs.growi.org/en/guide/features/page_layout.html)
+- **Pluggable**
+  - You can find plugins from [npm](https://www.npmjs.com/browse/keyword/growi-plugin) or [github](https://github.com/search?q=topic%3Agrowi-plugin)!
+- **[Docker Ready][dockerhub]**
+- **[Docker Compose Ready][docker-compose]**
+  - [GROWI Docs: Multiple sites](https://docs.growi.org/en/admin-guide/admin-cookbook/multi-app.html)
+  - [GROWI Docs: HTTPS(with Let's Encrypt) proxy integration](https://docs.growi.org/en/admin-guide/admin-cookbook/lets-encrypt.html)
+
+# Quick Start for Production
 
 
 ### docker-compose
 ### docker-compose
 
 
@@ -74,9 +70,7 @@ Quick Start for Production
 - [GROWI Docs: Install on Ubuntu Server](https://docs.growi.org/en/admin-guide/getting-started/ubuntu-server.html)
 - [GROWI Docs: Install on Ubuntu Server](https://docs.growi.org/en/admin-guide/getting-started/ubuntu-server.html)
 - [GROWI Docs: Install on CentOS](https://docs.growi.org/en/admin-guide/getting-started/centos.html)
 - [GROWI Docs: Install on CentOS](https://docs.growi.org/en/admin-guide/getting-started/centos.html)
 
 
-
-Configuration
-------------
+## Configuration
 
 
 See [GROWI Docs: Admin Guide](https://docs.growi.org/en/admin-guide/) ([en](https://docs.growi.org/en/admin-guide/)/[ja](https://docs.growi.org/ja/admin-guide/)).
 See [GROWI Docs: Admin Guide](https://docs.growi.org/en/admin-guide/) ([en](https://docs.growi.org/en/admin-guide/)/[ja](https://docs.growi.org/ja/admin-guide/)).
 
 
@@ -84,9 +78,7 @@ See [GROWI Docs: Admin Guide](https://docs.growi.org/en/admin-guide/) ([en](http
 
 
 See [GROWI Docs: Environment Variables](https://docs.growi.org/en/admin-guide/admin-cookbook/env-vars.html) ([en](https://docs.growi.org/en/admin-guide/admin-cookbook/env-vars.html)/[ja](https://docs.growi.org/ja/admin-guide/admin-cookbook/env-vars.html)).
 See [GROWI Docs: Environment Variables](https://docs.growi.org/en/admin-guide/admin-cookbook/env-vars.html) ([en](https://docs.growi.org/en/admin-guide/admin-cookbook/env-vars.html)/[ja](https://docs.growi.org/ja/admin-guide/admin-cookbook/env-vars.html)).
 
 
-
-Development
-==========
+# Development
 
 
 ## Dependencies
 ## Dependencies
 
 
@@ -95,72 +87,60 @@ Development
 - yarn
 - yarn
 - MongoDB 4.x
 - MongoDB 4.x
 
 
-See [confirmed versions](https://docs.growi.org/en/dev/startup/dev-env.html#set-up-node-js-environment).
-
 ### Optional Dependencies
 ### Optional Dependencies
 
 
 - Redis 3.x
 - Redis 3.x
 - ElasticSearch 6.x (needed when using Full-text search)
 - ElasticSearch 6.x (needed when using Full-text search)
-    - **CAUTION: Following plugins are required**
-        - [Japanese (kuromoji) Analysis plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-kuromoji.html)
-        - [ICU Analysis Plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-icu.html)
+  - **CAUTION: Following plugins are required**
+    - [Japanese (kuromoji) Analysis plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-kuromoji.html)
+    - [ICU Analysis Plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-icu.html)
 
 
 ## Command details
 ## Command details
 
 
-|command|desc|
-|--|--|
-|`yarn run build:prod`|Build the client|
-|`yarn run server:prod`|Launch the server|
-|`yarn start`|Invoke `yarn run build:prod` and `yarn run server:prod`|
+| command                | desc                                                    |
+| ---------------------- | ------------------------------------------------------- |
+| `yarn run build:prod`  | Build the client                                        |
+| `yarn run server:prod` | Launch the server                                       |
+| `yarn start`           | Invoke `yarn run build:prod` and `yarn run server:prod` |
 
 
-For more info, see [GROWI Docs: List of npm Commands](https://docs.growi.org/en/dev/startup-v2/launch.html#list-of-npm-commands).
+<!-- The following links do not exist -->
 
 
+For more info, see [GROWI Docs: List of npm Commands](https://docs.growi.org/en/dev/startup-v2/launch-system.html#list-of-npm-commands).
 
 
-Documentation
-==============
+# Documentation
 
 
 - [GROWI Docs](https://docs.growi.org/)
 - [GROWI Docs](https://docs.growi.org/)
 - [GROWI Developers Wiki (ja)](https://dev.growi.org/)
 - [GROWI Developers Wiki (ja)](https://dev.growi.org/)
 
 
+# Contribution
 
 
-Contribution
-============
-
-Found a Bug?
--------------
+## Found a Bug?
 
 
 If you found a bug in the source code, you can help us by
 If you found a bug in the source code, you can help us by
 [submitting an issue][issues] to our [GitHub Repository][growi]. Even better, you can
 [submitting an issue][issues] to our [GitHub Repository][growi]. Even better, you can
 [submit a Pull Request][pulls] with a fix.
 [submit a Pull Request][pulls] with a fix.
 
 
-Missing a Feature?
--------------------
+## Missing a Feature?
 
 
-You can *request* a new feature by [submitting an issue][issues] to our GitHub
-Repository. If you would like to *implement* a new feature, firstly please submit the issue with your proposal to make sure we can confirm it. Please clarify what kind of change you would like to propose.
+You can _request_ a new feature by [submitting an issue][issues] to our GitHub
+Repository. If you would like to _implement_ a new feature, firstly please submit the issue with your proposal to make sure we can confirm it. Please clarify what kind of change you would like to propose.
 
 
-* For a **Major Feature**, firstly open an issue and outline your proposal so it can be discussed.  
-It also allows us to coordinate better, prevent duplication of work and help you to create the change so it can be successfully accepted into the project.
-* **Small Features** can be created and directly [submitted as a Pull Request][pulls].
+- For a **Major Feature**, firstly open an issue and outline your proposal so it can be discussed.  
+  It also allows us to coordinate better, prevent duplication of work and help you to create the change so it can be successfully accepted into the project.
+- **Small Features** can be created and directly [submitted as a Pull Request][pulls].
 
 
-
-Language on GitHub
-------------------
+## Language on GitHub
 
 
 You can write issues and PRs in English or Japanese.
 You can write issues and PRs in English or Japanese.
 
 
-Discussion
------------
+## Discussion
 
 
 If you have questions or suggestions, you can [join our Slack team](https://growi-slackin.weseek.co.jp/) and talk about anything, anytime.
 If you have questions or suggestions, you can [join our Slack team](https://growi-slackin.weseek.co.jp/) and talk about anything, anytime.
 
 
+# License
 
 
-License
-=======
-
-* The MIT License (MIT)
-* See [LICENSE](https://github.com/weseek/growi/blob/master/LICENSE) and [THIRD-PARTY-NOTICES.md](https://github.com/weseek/growi/blob/master/THIRD-PARTY-NOTICES.md).
-
+- The MIT License (MIT)
+- See [LICENSE](https://github.com/weseek/growi/blob/master/LICENSE) and [THIRD-PARTY-NOTICES.md](https://github.com/weseek/growi/blob/master/THIRD-PARTY-NOTICES.md).
 
 
 [crowi]: https://github.com/crowi/crowi
 [crowi]: https://github.com/crowi/crowi
 [growi]: https://github.com/weseek/growi
 [growi]: https://github.com/weseek/growi

+ 148 - 0
README_JP.md

@@ -0,0 +1,148 @@
+- [English 🇺🇸](./README.md)
+  <p align="center">
+    <a href="https://growi.org">
+      <img src="https://user-images.githubusercontent.com/1638767/38254268-d4476bbe-3793-11e8-964c-8865d690baff.png" width="240px">
+    </a>
+  </p>
+  <p align="center">
+    <a href="https://github.com/weseek/growi/releases/latest"><img src="https://img.shields.io/github/release/weseek/growi.svg"></a>
+    <a href="https://growi-slackin.weseek.co.jp/"><img src="https://growi-slackin.weseek.co.jp/badge.svg"></a>
+  </p>
+
+<p align="center">
+  <a href="https://docs.growi.org">ドキュメント</a> / <a href="https://demo.growi.org">デモ</a>
+</p>
+
+# GROWI
+
+[![Actions Status](https://github.com/weseek/growi/workflows/Node%20CI/badge.svg)](https://github.com/weseek/growi/actions)
+[![dependencies status](https://david-dm.org/weseek/growi.svg)](https://david-dm.org/weseek/growi)
+[![devDependencies Status](https://david-dm.org/weseek/growi/dev-status.svg)](https://david-dm.org/weseek/growi?type=dev)
+[![docker pulls](https://img.shields.io/docker/pulls/weseek/growi.svg)](https://hub.docker.com/r/weseek/growi/)
+
+|                                                 デモンストレーション                                                 |
+| :-------------------------------------------------------------------------------------------------------------------: |
+| ![sample image](https://user-images.githubusercontent.com/42988650/70600974-6b29cc80-1c34-11ea-94ef-33c39c6a00dc.gif) |
+
+## 目次
+
+- [機能紹介](#機能紹介)
+- [クイックスタート](#クイックスタート)
+  - [docker-compose を使ってはじめる](#docker-compose-を使ってはじめる)
+  - [Helm (Experimental) でデプロイする](#Helm-Experimental-でデプロイする)
+  - [オンプレミス](#オンプレミスではじめる)
+- [環境変数](#環境変数)
+- [ドキュメント](#ドキュメント)
+- [ライセンス](#ライセンス)
+
+# 機能紹介
+
+- **主な機能**
+  - マークダウンを使用してページを階層構造で作成することが可能です。 -> 5 分間チュートリアルは[こちら](https://docs.growi.org/ja/guide/getting-started/five_minutes.html))。
+  - HackMD(CodiMd)[https://hackmd.io/] と連携することで同時多人数編集が可能です。
+    - [GROWI Docs: HackMD(CodiMD) 連携](https://docs.growi.org/ja/admin-guide/admin-cookbook/integrate-with-hackmd.html)
+  - LDAP / Active Direcotry , OAuth 認証をサポートしています。
+  - SAML を用いた Single Sign On が可能です。
+  - Slack / Mattermost, IFTTT と連携することが可能です。
+  - [GROWI Docs: 機能紹介](https://docs.growi.org/ja/guide/features/page_layout.html)
+- **プラグイン**
+  - [npm](https://www.npmjs.com/browse/keyword/growi-plugin) または [github](https://github.com/search?q=topic%3Agrowi-plugin) から 便利なプラグインを見つけることができます。
+- **[Docker の準備][dockerhub]**
+- **[Docker Compose の準備][docker-compose]**
+  - [GROWI Docs: 複数の GROWI を起動](https://docs.growi.org/ja/admin-guide/admin-cookbook/multi-app.html)
+  - [GROWI Docs: Let's Encrypt による HTTPS 運用](https://docs.growi.org/ja/admin-guide/admin-cookbook/lets-encrypt.html)
+
+# クイックスタート
+
+### docker-compose を使ってはじめる
+
+- [GROWI Docs: docker-compose](https://docs.growi.org/ja/admin-guide/getting-started/docker-compose.html) ([en](https://docs.growi.org/en/admin-guide/getting-started/docker-compose.html)/[ja](https://docs.growi.org/ja/admin-guide/getting-started/docker-compose.html))
+
+### Helm (Experimental) でデプロイする
+
+- [GROWI Helm Chart](https://github.com/weseek/helm-charts/tree/master/charts/growi)
+
+### オンプレミスではじめる
+
+Crowi からの移行は **[こちら](https://docs.growi.org/en/admin-guide/migration-guide/from-crowi-onpremise.html) ([en](https://docs.growi.org/en/admin-guide/migration-guide/from-crowi-onpremise.html)/[ja](https://docs.growi.org/ja/admin-guide/migration-guide/from-crowi-onpremise.html))**。
+
+- [GROWI Docs: Ubuntu Server 上でインストール](https://docs.growi.org/ja/admin-guide/getting-started/ubuntu-server.html)
+- [GROWI Docs: CentOS 上でインストール](https://docs.growi.org/ja/admin-guide/getting-started/centos.html)
+
+## 設定
+
+[GROWI Docs: 管理者ガイド](https://docs.growi.org/ja/admin-guide/) ([en](https://docs.growi.org/en/admin-guide/)/[ja](https://docs.growi.org/ja/admin-guide/))をご覧ください。
+
+### 環境変数
+
+[GROWI Docs: 環境変数](https://docs.growi.org/ja/admin-guide/admin-cookbook/env-vars.html) ([en](https://docs.growi.org/en/admin-guide/admin-cookbook/env-vars.html)/[ja](https://docs.growi.org/ja/admin-guide/admin-cookbook/env-vars.html)) をご覧ください。
+
+# 開発環境
+
+## 依存関係
+
+- Node.js v12.x or v14.x
+- npm 6.x
+- yarn
+- MongoDB 4.x
+
+### オプションの依存関係
+
+- Redis 3.x
+- ElasticSearch 6.x (needed when using Full-text search)
+  - **注意: 次のプラグインが必要です**
+    - [Japanese (kuromoji) Analysis plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-kuromoji.html)
+    - [ICU Analysis Plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-icu.html)
+
+## コマンド詳細
+
+| コマンド               | 説明                                                             |
+| ---------------------- | ---------------------------------------------------------------- |
+| `yarn run build:prod`  | クライアントをビルドします。                                     |
+| `yarn run server:prod` | サーバーを起動します。                                           |
+| `yarn start`           | `yarn run build:prod` と `yarn run server:prod` を呼び出します。 |
+
+  <!-- 以下のリンクは存在しない (ja と en 両方) -->
+
+詳しくは [GROWI Docs: List of npm Commands](https://docs.growi.org/ja/dev/startup-v2/launch-system.html#npm-コマンドリスト)をご覧ください。
+
+# ドキュメント
+
+- [GROWI Docs](https://docs.growi.org/)
+- [GROWI Developers Wiki](https://dev.growi.org/)
+
+# コントリビューション
+
+## バグがありましたか?
+
+ソースコード上でバグを発見されたら、私たちの GitHub 上の Repository にて Issue を作成していただけると助かります。バグを修正して Pull requests を提出していただけるとさらに助かります。
+
+## 欲しい機能が見あたりませんか?
+
+私たちの GitHub 上の リポジトリに Issue を出して、新しい機能をリクエストすることができます。新機能を実装したい場合も同様に、まずは Issue を提出してください。どのような新機能や変更を提案されるのかを明確にしていただきます。
+
+- **大規模な機能追加につきましては**、Issue を open にした上で、提案された概要を説明していただき、議論できる状態にします。
+  議論を積み重ねることで、提案内容を双方向的に実装したい機能を整理することができ、実装の重複を防ぐことにもなります。これによって、GROWI への導入がスムーズになります。
+
+- **小規模な機能追加につきましては**、 Issue を作成し、直接 [Pull requests][pulls] を提出してください。
+
+## GitHub 上での言語について
+
+Issue と Pull requests の作成は英語・日本語どちらでも受け付けています。
+
+## GROWI について話し合いましょう!
+
+質問や提案があれば、私たちの [Slack team](https://growi-slackin.weseek.co.jp/) にぜひご参加ください。
+いつでも、どこでも GROWI について議論しましょう!
+
+# ライセンス
+
+- The MIT License (MIT)
+- [ライセンス](https://github.com/weseek/growi/blob/master/LICENSE) と [THIRD-PARTY-NOTICES.md](https://github.com/weseek/growi/blob/master/THIRD-PARTY-NOTICES.md) をご覧ください。
+
+  [crowi]: https://github.com/crowi/crowi
+  [growi]: https://github.com/weseek/growi
+  [issues]: https://github.com/weseek/growi/issues
+  [pulls]: https://github.com/weseek/growi/pulls
+  [dockerhub]: https://hub.docker.com/r/weseek/growi
+  [docker-compose]: https://github.com/weseek/growi-docker-compose

+ 40 - 0
src/migrations/2021042016038-convert-double-to-date.js

@@ -0,0 +1,40 @@
+require('module-alias/register');
+const logger = require('@alias/logger')('growi:migrate:convert-double-to-date');
+
+const mongoose = require('mongoose');
+const config = require('@root/config/migrate');
+
+const { getModelSafely } = require('@commons/util/mongoose-utils');
+
+module.exports = {
+  async up(db) {
+    logger.info('Apply migration');
+    mongoose.connect(config.mongoUri, config.mongodb.options);
+
+    const Page = getModelSafely('Page') || require('@server/models/page')();
+
+    const pages = await Page.find({ updatedAt: { $type: 'double' } });
+
+    if (pages.length === 0) {
+      return logger.info('The target page did not exist.');
+    }
+
+    const operations = pages.map((page) => {
+      return {
+        updateMany: {
+          filter: { _id: page._id },
+          update: { updatedAt: new Date(page.updatedAt) },
+        },
+      };
+    });
+
+    await Page.bulkWrite(operations);
+
+    logger.info('Migration has successfully applied');
+
+  },
+
+  down(db) {
+    // do not rollback
+  },
+};

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

@@ -102,7 +102,9 @@ class PageService {
       const revisionId = new mongoose.Types.ObjectId();
       const revisionId = new mongoose.Types.ObjectId();
 
 
       if (updateMetadata) {
       if (updateMetadata) {
-        unorderedBulkOp.find({ _id: page._id }).update({ $set: { path: newPagePath, lastUpdateUser: user._id, updatedAt:  Date.now() } });
+        unorderedBulkOp
+          .find({ _id: page._id })
+          .update({ $set: { path: newPagePath, lastUpdateUser: user._id, updatedAt: Date.now().toISOString() } });
       }
       }
       else {
       else {
         unorderedBulkOp.find({ _id: page._id }).update({ $set: { path: newPagePath } });
         unorderedBulkOp.find({ _id: page._id }).update({ $set: { path: newPagePath } });