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

Merge pull request #167 from weseek/master

release v2.0.9
Yuki Takei 8 лет назад
Родитель
Сommit
7a52b2c9f7
9 измененных файлов с 360 добавлено и 273 удалено
  1. 33 9
      .github/ISSUE_TEMPLATE.md
  2. 6 0
      CHANGES.md
  3. 14 11
      README.md
  4. 1 1
      app.json
  5. 5 0
      lib/models/page.js
  6. 17 10
      lib/routes/me.js
  7. 1 1
      lib/views/me/api_token.html
  8. 5 5
      package.json
  9. 278 236
      yarn.lock

+ 33 - 9
.github/ISSUE_TEMPLATE.md

@@ -1,35 +1,58 @@
 Environment
 ------------
 
-- [OS]
-- [crowi-plus] x.x.x
-- [node.js] y.y.y
-- [browser] z.z.z
+### Host
+
+| item     | version |
+| ---      | --- |
+|OS        ||
+|crowi-plus|x.y.z|
+|node.js   |x.y.z|
+|npm       |x.y.z|
+|Using Docker|yes/no|
+|Using [crowi-plus-docker-compose][crowi-plus-docker-compose]|yes/no|
+
+[crowi-plus-docker-compose]: https://github.com/weseek/crowi-plus-docker-compose
+
+*(Accessing https://{CROWI_HOST}/admin helps you to fill in above versions)*
+
+
+### Client
+
+| item     | version |
+| ---      | --- |
+|OS        ||
+|browser   |x.y.z|
+
 
 
 How to reproduce? (再現手順)
 ---------------------------
 
 1. process 1
-
+1. process 2
+1. process 3
     ```bash
     
     ```
 
-1. process 2
-1. process 3
-
+1. process 4
+    ```bash
+    
+    ```
 
 What happens? (症状)
 ---------------------
 
-- symptom
+- symptom 1
+- symptom 2
 
 ```
 Stack Trace
 ```
 
 
+
 What is the expected result? (期待される動作)
 -------------------------------------------
 
@@ -37,6 +60,7 @@ What is the expected result? (期待される動作)
 - 
 
 
+
 Note
 ----
 

+ 6 - 0
CHANGES.md

@@ -1,6 +1,12 @@
 CHANGES
 ========
 
+## 2.0.9
+
+* Fix: Server is down when a guest user accesses to someone's private pages
+* Support: Merge official Crowi (master branch)
+* Support: Upgrade outdated libs
+
 ## 2.0.8
 
 * Fix: The problem that path including round bracket makes something bad

+ 14 - 11
README.md

@@ -72,6 +72,8 @@ See also [weseek/crowi-plus-docker-compose][docker-compose]
 On-premise
 ----------
 
+[**Migration Guide from Official Crowi** is here](https://github.com/weseek/crowi-plus/wiki/Migration-Guide-from-Official-Crowi).
+
 ### Dependencies
 
 - node 6.x (DON'T USE 7.x)
@@ -83,14 +85,15 @@ See [confirmed versions](https://github.com/weseek/crowi-plus/wiki/Developers-Gu
 
 #### Optional Dependencies
 
-- Redix 3.x
-- ElasticSearch 5.x
-  - Japanese (kuromoji) Analysis plugin
-  - ICU Analysis Plugin
+- Redis 3.x
+- ElasticSearch 5.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)
 
 ### Start
 
-## Build and run the app
+#### Build and run the app
 
 ```bash
 git clone https://github.com/weseek/crowi-plus.git
@@ -110,7 +113,7 @@ export ELASTICSEARCH_URI=http://ELASTICSEARCH_HOST:ELASTICSEARCH_PORT/crowi
 npm start
 ```
 
-For more info, check [the official documents](https://github.com/crowi/crowi/wiki/Install-and-Configuration#env-parameters).
+For more info, check [Developers Guide](https://github.com/weseek/crowi-plus/wiki/Developers-Guide) and [the official documents](https://github.com/crowi/crowi/wiki/Install-and-Configuration#env-parameters).
 
 #### Command details
 
@@ -146,16 +149,15 @@ npm start
 Getting Started to Develop
 ==========================
 
-## Build and Running the app
+## Build and Run the app
 
 1. `clone` this repository
 1. `yarn global add npm@4` to install required global dependencies
 1. `yarn` to install all dependencies
     * DON'T USE `npm install`
 1. `npm run build` to build client app
-1. `npm run server` to start the dev server in another tab
-
-After you have installed all dependencies and build client you can now run the app. Run `npm run server` to start a local server using `node-dev` which will watch server-side codes and reload for you. The port will be displayed to you as `http://0.0.0.0:3000`.
+1. `npm run server` to start the dev server
+1. Access to `http://0.0.0.0:3000`
 
 For more info, read [Developers Guide](https://github.com/weseek/crowi-plus/wiki/Developers-Guide) on Wiki.
 
@@ -165,7 +167,8 @@ Documentation
 
 * [github wiki pages](https://github.com/weseek/crowi-plus/wiki)
   * [Questions and Answers](https://github.com/weseek/crowi-plus/wiki/Questions-and-Answers)
-* [Developers Guide](https://github.com/weseek/crowi-plus/wiki/Developers-Guide)
+  * [Migration Guide from Official Crowi](https://github.com/weseek/crowi-plus/wiki/Migration-Guide-from-Official-Crowi)
+  * [Developers Guide](https://github.com/weseek/crowi-plus/wiki/Developers-Guide)
 
 Contributing
 ============

+ 1 - 1
app.json

@@ -27,7 +27,7 @@
     "mongolab",
     "redistogo",
     {
-      "plan": "bonsai",
+      "plan": "bonsai:sandbox-10",
       "options": {
         "version": "5.1"
       }

+ 5 - 0
lib/models/page.js

@@ -94,6 +94,11 @@ module.exports = function(crowi) {
   };
 
   pageSchema.methods.isCreator = function(userData) {
+    // ゲスト閲覧の場合は userData に false が入る
+    if (!userData) {
+      return false;
+    }
+
     if (this.populated('creator') && this.creator._id.toString() === userData._id.toString()) {
       return true;
     } else if (this.creator.toString() === userData._id.toString()) {

+ 17 - 10
lib/routes/me.js

@@ -89,20 +89,27 @@ module.exports = function(crowi, app) {
         return res.render('me/index', {});
       }
 
-      userData.update(name, email, lang, function(err, userData) {
-        if (err) {
-          for (var e in err.errors) {
-            if (err.errors.hasOwnProperty(e)) {
-              req.form.errors.push(err.errors[e].message);
-            }
-          }
+      User.findOne({email: email}, (err, existingUserData) => {
+        if (existingUserData) {
+          debug('Email address was duplicated');
+          req.form.errors.push('It can not be changed to that mail address');
           return res.render('me/index', {});
         }
 
-        req.i18n.changeLanguage(lang);
-        req.flash('successMessage', req.t('Updated'));
-        return res.redirect('/me');
+        userData.update(name, email, lang, (err, userData) => {
+          if (err) {
+            Object.keys(err.errors).forEach((e) => {
+              req.form.errors.push(err.errors[e].message);
+            });
+            return res.render('me/index', {});
+          }
+
+          req.i18n.changeLanguage(lang);
+          req.flash('successMessage', req.t('Updated'));
+          return res.redirect('/me');
+        });
       });
+
     } else { // method GET
       /// そのうちこのコードはいらなくなるはず
       if (!userData.isEmailSet()) {

+ 1 - 1
lib/views/me/api_token.html

@@ -16,7 +16,7 @@
 
   <ul class="nav nav-tabs">
     <li><a href="/me"><i class="fa fa-gears"></i> {{ t('User Information') }}</a></li>
-    <li><a href="/me/password"><i class="fa fa-key"></i> {{ t('Password Setting') }}</a></li>
+    <li><a href="/me/password"><i class="fa fa-key"></i> {{ t('Password Settings') }}</a></li>
     <li class="active"><a href="/me/apiToken"><i class="fa fa-rocket"></i> {{ t('API Settings') }}</a></li>
   </ul>
 

+ 5 - 5
package.json

@@ -1,6 +1,6 @@
 {
   "name": "crowi-plus",
-  "version": "2.0.8-RC",
+  "version": "2.0.9-RC",
   "description": "Enhanced Crowi",
   "tags": [
     "wiki",
@@ -55,7 +55,7 @@
     "basic-auth-connect": "~1.0.0",
     "body-parser": "^1.17.1",
     "bootstrap-sass": "~3.3.6",
-    "botkit": "~0.5.5",
+    "botkit": "^0.6.0",
     "check-node-version": "^2.0.1",
     "connect-flash": "~0.1.1",
     "connect-redis": "^3.3.0",
@@ -74,12 +74,12 @@
     "express-form": "~0.12.0",
     "express-pino-logger": "^2.0.0",
     "express-session": "~1.15.0",
-    "express-webpack-assets": "0.0.2",
+    "express-webpack-assets": "^0.1.0",
     "file-loader": "^0.11.1",
-    "googleapis": "^20.0.1",
+    "googleapis": "^21.3.0",
     "graceful-fs": "^4.1.11",
     "highlight.js": "^9.10.0",
-    "i18next": "^8.4.2",
+    "i18next": "^9.0.0",
     "i18next-express-middleware": "^1.0.5",
     "i18next-node-fs-backend": "^1.0.0",
     "i18next-sprintf-postprocessor": "^0.2.2",

Разница между файлами не показана из-за своего большого размера
+ 278 - 236
yarn.lock


Некоторые файлы не были показаны из-за большого количества измененных файлов