Explorar el Código

fix lint errors

Yuki Takei hace 8 años
padre
commit
3d179149c8
Se han modificado 56 ficheros con 566 adiciones y 556 borrados
  1. 1 1
      config/webpack.dev.js
  2. 1 1
      config/webpack.prod.js
  3. 9 8
      lib/crowi/express-init.js
  4. 1 1
      lib/form/revision.js
  5. 5 4
      lib/models/attachment.js
  6. 1 1
      lib/models/comment.js
  7. 63 101
      lib/models/config.js
  8. 2 2
      lib/models/external-account.js
  9. 9 9
      lib/models/page-group-relation.js
  10. 139 131
      lib/models/page.js
  11. 14 21
      lib/models/updatePost.js
  12. 6 6
      lib/models/user-group-relation.js
  13. 8 8
      lib/models/user-group.js
  14. 38 36
      lib/models/user.js
  15. 2 2
      lib/plugins/plugin-utils-v2.js
  16. 1 1
      lib/plugins/plugin-utils.js
  17. 97 80
      lib/routes/admin.js
  18. 9 8
      lib/routes/attachment.js
  19. 4 3
      lib/routes/bookmark.js
  20. 6 6
      lib/routes/comment.js
  21. 1 1
      lib/routes/index.js
  22. 3 2
      lib/routes/installer.js
  23. 2 1
      lib/routes/login-passport.js
  24. 32 25
      lib/routes/me.js
  25. 7 4
      lib/routes/revision.js
  26. 3 2
      lib/routes/search.js
  27. 8 6
      lib/routes/user.js
  28. 4 8
      lib/service/notification.js
  29. 4 4
      lib/service/passport.js
  30. 6 5
      lib/util/apiResponse.js
  31. 11 10
      lib/util/mailer.js
  32. 16 11
      lib/util/middlewares.js
  33. 1 1
      lib/util/xss.js
  34. 1 1
      local_modules/crowi-fileupload-local/index.js
  35. 2 1
      resource/js/components/BookmarkButton.js
  36. 2 2
      resource/js/components/CopyButton.js
  37. 2 2
      resource/js/components/Page/RevisionBody.js
  38. 1 1
      resource/js/components/Page/RevisionUrl.js
  39. 1 1
      resource/js/components/PageAttachment/DeleteAttachmentModal.js
  40. 1 1
      resource/js/components/PageAttachment/PageAttachmentList.js
  41. 1 1
      resource/js/components/PageComment/Comment.js
  42. 2 2
      resource/js/components/PageComment/DeleteCommentModal.js
  43. 3 2
      resource/js/components/PageCommentFormBehavior.js
  44. 2 2
      resource/js/components/PageEditor/MarkdownListUtil.js
  45. 5 4
      resource/js/components/PageEditor/MarkdownTableUtil.js
  46. 1 1
      resource/js/components/PageEditor/Preview.js
  47. 3 2
      resource/js/components/PageEditor/ScrollSyncHelper.js
  48. 3 2
      resource/js/components/PageHistory.js
  49. 7 6
      resource/js/components/PageHistory/PageRevisionList.js
  50. 2 2
      resource/js/components/PageHistory/Revision.js
  51. 1 1
      resource/js/components/PageHistory/RevisionDiff.js
  52. 1 1
      resource/js/components/PageList/ListView.js
  53. 1 1
      resource/js/components/PageList/Page.js
  54. 4 4
      resource/js/components/PageListSearch.js
  55. 2 2
      resource/js/components/ReactUtils.js
  56. 4 4
      resource/js/components/SearchPage.js

+ 1 - 1
config/webpack.dev.js

@@ -99,4 +99,4 @@ module.exports = function(options) {
 
 
     ]
     ]
   });
   });
-}
+};

+ 1 - 1
config/webpack.prod.js

@@ -116,4 +116,4 @@ module.exports = function(env) {
     ],
     ],
 
 
   });
   });
-}
+};

+ 9 - 8
lib/crowi/express-init.js

@@ -70,11 +70,11 @@ module.exports = function(crowi, app) {
     res.locals.now      = now;
     res.locals.now      = now;
     res.locals.tzoffset = tzoffset;
     res.locals.tzoffset = tzoffset;
     res.locals.consts   = {
     res.locals.consts   = {
-        pageGrants: Page.getGrantLabels(),
-        userStatus: User.getUserStatusLabels(),
-        language:   User.getLanguageLabels(),
-        restrictGuestMode: Config.getRestrictGuestModeLabels(),
-        registrationMode: Config.getRegistrationModeLabels(),
+      pageGrants: Page.getGrantLabels(),
+      userStatus: User.getUserStatusLabels(),
+      language:   User.getLanguageLabels(),
+      restrictGuestMode: Config.getRestrictGuestModeLabels(),
+      registrationMode: Config.getRegistrationModeLabels(),
     };
     };
     res.locals.local_config = Config.getLocalconfig(config); // config for browser context
     res.locals.local_config = Config.getLocalconfig(config); // config for browser context
 
 
@@ -82,7 +82,7 @@ module.exports = function(crowi, app) {
   });
   });
 
 
   app.set('port', crowi.port);
   app.set('port', crowi.port);
-  const staticOption = (crowi.node_env === 'production') ? {maxAge:'30d'} : {};
+  const staticOption = (crowi.node_env === 'production') ? {maxAge: '30d'} : {};
   app.use(express.static(crowi.publicDir, staticOption));
   app.use(express.static(crowi.publicDir, staticOption));
   app.engine('html', swig.renderFile);
   app.engine('html', swig.renderFile);
   app.use(webpackAssets(
   app.use(webpackAssets(
@@ -109,14 +109,15 @@ module.exports = function(crowi, app) {
       return basicAuth(
       return basicAuth(
         config.crowi['security:basicName'],
         config.crowi['security:basicName'],
         config.crowi['security:basicSecret'])(req, res, next);
         config.crowi['security:basicSecret'])(req, res, next);
-    } else {
+    }
+    else {
       next();
       next();
     }
     }
   });
   });
 
 
   // passport
   // passport
   if (Config.isEnabledPassport(config)) {
   if (Config.isEnabledPassport(config)) {
-    debug('initialize Passport')
+    debug('initialize Passport');
     app.use(passport.initialize());
     app.use(passport.initialize());
     app.use(passport.session());
     app.use(passport.session());
   }
   }

+ 1 - 1
lib/form/revision.js

@@ -5,7 +5,7 @@ var form = require('express-form')
 
 
 module.exports = form(
 module.exports = form(
   field('pageForm.path').required(),
   field('pageForm.path').required(),
-  field('pageForm.body').required().custom(function(value) { return value.replace(/\r/g, '\n'); }),
+  field('pageForm.body').required().custom(function(value) { return value.replace(/\r/g, '\n') }),
   field('pageForm.currentRevision'),
   field('pageForm.currentRevision'),
   field('pageForm.grant').toInt().required(),
   field('pageForm.grant').toInt().required(),
   field('pageForm.notify')
   field('pageForm.notify')

+ 5 - 4
lib/models/attachment.js

@@ -5,7 +5,7 @@ module.exports = function(crowi) {
     , fileUploader = require('../util/fileUploader')(crowi)
     , fileUploader = require('../util/fileUploader')(crowi)
   ;
   ;
 
 
-  function generateFileHash (fileName) {
+  function generateFileHash(fileName) {
     var hasher = require('crypto').createHash('md5');
     var hasher = require('crypto').createHash('md5');
     hasher.update(fileName);
     hasher.update(fileName);
 
 
@@ -105,7 +105,7 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  attachmentSchema.statics.guessExtByFileType = function (fileType) {
+  attachmentSchema.statics.guessExtByFileType = function(fileType) {
     let ext = '';
     let ext = '';
     const isImage = fileType.match(/^image\/(.+)/i);
     const isImage = fileType.match(/^image\/(.+)/i);
 
 
@@ -116,14 +116,15 @@ module.exports = function(crowi) {
     return ext;
     return ext;
   };
   };
 
 
-  attachmentSchema.statics.createAttachmentFilePath = function (pageId, fileName, fileType) {
+  attachmentSchema.statics.createAttachmentFilePath = function(pageId, fileName, fileType) {
     const Attachment = this;
     const Attachment = this;
     let ext = '';
     let ext = '';
     const fnExt = fileName.match(/(.*)(?:\.([^.]+$))/);
     const fnExt = fileName.match(/(.*)(?:\.([^.]+$))/);
 
 
     if (fnExt) {
     if (fnExt) {
       ext = '.' + fnExt[2];
       ext = '.' + fnExt[2];
-    } else {
+    }
+    else {
       ext = Attachment.guessExtByFileType(fileType);
       ext = Attachment.guessExtByFileType(fileType);
       if (ext !== '') {
       if (ext !== '') {
         ext = '.' + ext;
         ext = '.' + ext;

+ 1 - 1
lib/models/comment.js

@@ -110,7 +110,7 @@ module.exports = function(crowi) {
         }
         }
 
 
         resolve(done);
         resolve(done);
-      });;
+      });
     });
     });
   };
   };
 
 

+ 63 - 101
lib/models/config.js

@@ -2,7 +2,6 @@ module.exports = function(crowi) {
   var mongoose = require('mongoose')
   var mongoose = require('mongoose')
     , debug = require('debug')('growi:models:config')
     , debug = require('debug')('growi:models:config')
     , uglifycss = require('uglifycss')
     , uglifycss = require('uglifycss')
-    , ObjectId = mongoose.Schema.Types.ObjectId
     , configSchema
     , configSchema
     , Config
     , Config
 
 
@@ -39,8 +38,8 @@ module.exports = function(crowi) {
   /**
   /**
    * default values when migrated from Official Crowi
    * default values when migrated from Official Crowi
    */
    */
-  function getDefaultCrowiConfigs()
-  {
+  function getDefaultCrowiConfigs() {
+    /* eslint-disable key-spacing */
     return {
     return {
       //'app:installed'     : "0.0.0",
       //'app:installed'     : "0.0.0",
       'app:confidential'  : '',
       'app:confidential'  : '',
@@ -94,13 +93,14 @@ module.exports = function(crowi) {
       'customize:isSavedStatesOfTabChanges' : true,
       'customize:isSavedStatesOfTabChanges' : true,
       'customize:isEnabledAttachTitleHeader' : false,
       'customize:isEnabledAttachTitleHeader' : false,
     };
     };
+    /* eslint-enable */
   }
   }
 
 
   function getDefaultMarkdownConfigs() {
   function getDefaultMarkdownConfigs() {
     return {
     return {
       'markdown:isEnabledLinebreaks': true,
       'markdown:isEnabledLinebreaks': true,
       'markdown:isEnabledLinebreaksInComments': true,
       'markdown:isEnabledLinebreaksInComments': true,
-    }
+    };
   }
   }
 
 
   function getValueForCrowiNS(config, key) {
   function getValueForCrowiNS(config, key) {
@@ -112,8 +112,7 @@ module.exports = function(crowi) {
     return config.crowi[key];
     return config.crowi[key];
   }
   }
 
 
-  configSchema.statics.getRestrictGuestModeLabels = function()
-  {
+  configSchema.statics.getRestrictGuestModeLabels = function() {
     var labels = {};
     var labels = {};
     labels[SECURITY_RESTRICT_GUEST_MODE_DENY]     = 'security_setting.guest_mode.deny';
     labels[SECURITY_RESTRICT_GUEST_MODE_DENY]     = 'security_setting.guest_mode.deny';
     labels[SECURITY_RESTRICT_GUEST_MODE_READONLY] = 'security_setting.guest_mode.readonly';
     labels[SECURITY_RESTRICT_GUEST_MODE_READONLY] = 'security_setting.guest_mode.readonly';
@@ -121,8 +120,7 @@ module.exports = function(crowi) {
     return labels;
     return labels;
   };
   };
 
 
-  configSchema.statics.getRegistrationModeLabels = function()
-  {
+  configSchema.statics.getRegistrationModeLabels = function() {
     var labels = {};
     var labels = {};
     labels[SECURITY_REGISTRATION_MODE_OPEN]       = 'security_setting.registration_mode.open';
     labels[SECURITY_REGISTRATION_MODE_OPEN]       = 'security_setting.registration_mode.open';
     labels[SECURITY_REGISTRATION_MODE_RESTRICTED] = 'security_setting.registration_mode.restricted';
     labels[SECURITY_REGISTRATION_MODE_RESTRICTED] = 'security_setting.registration_mode.restricted';
@@ -131,11 +129,10 @@ module.exports = function(crowi) {
     return labels;
     return labels;
   };
   };
 
 
-  configSchema.statics.updateConfigCache = function(ns, config)
-  {
+  configSchema.statics.updateConfigCache = function(ns, config) {
     var originalConfig = crowi.getConfig();
     var originalConfig = crowi.getConfig();
     var newNSConfig = originalConfig[ns] || {};
     var newNSConfig = originalConfig[ns] || {};
-    Object.keys(config).forEach(function (key) {
+    Object.keys(config).forEach(function(key) {
       if (config[key] || config[key] === '' || config[key] === false) {
       if (config[key] || config[key] === '' || config[key] === false) {
         newNSConfig[key] = config[key];
         newNSConfig[key] = config[key];
       }
       }
@@ -150,10 +147,9 @@ module.exports = function(crowi) {
   };
   };
 
 
   // Execute only once for installing application
   // Execute only once for installing application
-  configSchema.statics.applicationInstall = function(callback)
-  {
+  configSchema.statics.applicationInstall = function(callback) {
     var Config = this;
     var Config = this;
-    Config.count({ ns: 'crowi' }, function (err, count) {
+    Config.count({ ns: 'crowi' }, function(err, count) {
       if (count > 0) {
       if (count > 0) {
         return callback(new Error('Application already installed'), null);
         return callback(new Error('Application already installed'), null);
       }
       }
@@ -165,8 +161,7 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  configSchema.statics.setupCofigFormData = function(ns, config)
-  {
+  configSchema.statics.setupCofigFormData = function(ns, config) {
     var defaultConfig = {};
     var defaultConfig = {};
 
 
     // set Default Settings
     // set Default Settings
@@ -180,7 +175,7 @@ module.exports = function(crowi) {
     if (!defaultConfig[ns]) {
     if (!defaultConfig[ns]) {
       defaultConfig[ns] = {};
       defaultConfig[ns] = {};
     }
     }
-    Object.keys(config[ns] || {}).forEach(function (key) {
+    Object.keys(config[ns] || {}).forEach(function(key) {
       if (config[ns][key] !== undefined) {
       if (config[ns][key] !== undefined) {
         defaultConfig[key] = config[ns][key];
         defaultConfig[key] = config[ns][key];
       }
       }
@@ -189,47 +184,43 @@ module.exports = function(crowi) {
   };
   };
 
 
 
 
-  configSchema.statics.updateNamespaceByArray = function(ns, configs, callback)
-  {
+  configSchema.statics.updateNamespaceByArray = function(ns, configs, callback) {
     var Config = this;
     var Config = this;
     if (configs.length < 0) {
     if (configs.length < 0) {
       return callback(new Error('Argument #1 is not array.'), null);
       return callback(new Error('Argument #1 is not array.'), null);
     }
     }
 
 
-    Object.keys(configs).forEach(function (key) {
+    Object.keys(configs).forEach(function(key) {
       var value = configs[key];
       var value = configs[key];
 
 
       Config.findOneAndUpdate(
       Config.findOneAndUpdate(
         { ns: ns, key: key },
         { ns: ns, key: key },
         { ns: ns, key: key, value: JSON.stringify(value) },
         { ns: ns, key: key, value: JSON.stringify(value) },
         { upsert: true, },
         { upsert: true, },
-        function (err, config) {
+        function(err, config) {
           debug('Config.findAndUpdate', err, config);
           debug('Config.findAndUpdate', err, config);
-      });
+        });
     });
     });
 
 
     return callback(null, configs);
     return callback(null, configs);
   };
   };
 
 
-  configSchema.statics.findAndUpdate = function(ns, key, value, callback)
-  {
+  configSchema.statics.findAndUpdate = function(ns, key, value, callback) {
     var Config = this;
     var Config = this;
     Config.findOneAndUpdate(
     Config.findOneAndUpdate(
       { ns: ns, key: key },
       { ns: ns, key: key },
       { ns: ns, key: key, value: JSON.stringify(value) },
       { ns: ns, key: key, value: JSON.stringify(value) },
       { upsert: true, },
       { upsert: true, },
-      function (err, config) {
+      function(err, config) {
         debug('Config.findAndUpdate', err, config);
         debug('Config.findAndUpdate', err, config);
         callback(err, config);
         callback(err, config);
-    });
+      });
   };
   };
 
 
-  configSchema.statics.getConfig = function(callback)
-  {
+  configSchema.statics.getConfig = function(callback) {
   };
   };
 
 
-  configSchema.statics.loadAllConfig = function(callback)
-  {
+  configSchema.statics.loadAllConfig = function(callback) {
     var Config = this
     var Config = this
       , config = {};
       , config = {};
     config.crowi = {}; // crowi namespace
     config.crowi = {}; // crowi namespace
@@ -255,14 +246,12 @@ module.exports = function(crowi) {
       });
       });
   };
   };
 
 
-  configSchema.statics.appTitle = function(config)
-  {
+  configSchema.statics.appTitle = function(config) {
     const key = 'app:title';
     const key = 'app:title';
     return getValueForCrowiNS(config, key) || 'GROWI';
     return getValueForCrowiNS(config, key) || 'GROWI';
   };
   };
 
 
-  configSchema.statics.isEnabledPassport = function(config)
-  {
+  configSchema.statics.isEnabledPassport = function(config) {
     // always true if growi installed cleanly
     // always true if growi installed cleanly
     if (Object.keys(config.crowi).length == 0) {
     if (Object.keys(config.crowi).length == 0) {
       return true;
       return true;
@@ -272,24 +261,21 @@ module.exports = function(crowi) {
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
   };
   };
 
 
-  configSchema.statics.isEnabledPassportLdap = function(config)
-  {
+  configSchema.statics.isEnabledPassportLdap = function(config) {
     const key = 'security:passport-ldap:isEnabled';
     const key = 'security:passport-ldap:isEnabled';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
   };
   };
 
 
-  configSchema.statics.isSameUsernameTreatedAsIdenticalUser = function(config, providerType)
-  {
+  configSchema.statics.isSameUsernameTreatedAsIdenticalUser = function(config, providerType) {
     const key = `security:passport-${providerType}:isSameUsernameTreatedAsIdenticalUser`;
     const key = `security:passport-${providerType}:isSameUsernameTreatedAsIdenticalUser`;
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
   };
   };
 
 
-  configSchema.statics.isUploadable = function(config)
-  {
+  configSchema.statics.isUploadable = function(config) {
     var method = crowi.env.FILE_UPLOAD || 'aws';
     var method = crowi.env.FILE_UPLOAD || 'aws';
 
 
     if (method == 'aws' && (
     if (method == 'aws' && (
-        !config.crowi['aws:accessKeyId'] ||
+      !config.crowi['aws:accessKeyId'] ||
         !config.crowi['aws:secretAccessKey'] ||
         !config.crowi['aws:secretAccessKey'] ||
         !config.crowi['aws:region'] ||
         !config.crowi['aws:region'] ||
         !config.crowi['aws:bucket'])) {
         !config.crowi['aws:bucket'])) {
@@ -299,8 +285,7 @@ module.exports = function(crowi) {
     return method != 'none';
     return method != 'none';
   };
   };
 
 
-  configSchema.statics.isGuesstAllowedToRead = function(config)
-  {
+  configSchema.statics.isGuesstAllowedToRead = function(config) {
     // return false if undefined
     // return false if undefined
     if (undefined === config.crowi || undefined === config.crowi['security:restrictGuestMode']) {
     if (undefined === config.crowi || undefined === config.crowi['security:restrictGuestMode']) {
       return false;
       return false;
@@ -309,14 +294,12 @@ module.exports = function(crowi) {
     return SECURITY_RESTRICT_GUEST_MODE_READONLY === config.crowi['security:restrictGuestMode'];
     return SECURITY_RESTRICT_GUEST_MODE_READONLY === config.crowi['security:restrictGuestMode'];
   };
   };
 
 
-  configSchema.statics.isEnabledPlugins = function(config)
-  {
+  configSchema.statics.isEnabledPlugins = function(config) {
     const key = 'plugin:isEnabledPlugins';
     const key = 'plugin:isEnabledPlugins';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
   };
   };
 
 
-  configSchema.statics.isEnabledLinebreaks = function(config)
-  {
+  configSchema.statics.isEnabledLinebreaks = function(config) {
     const key = 'markdown:isEnabledLinebreaks';
     const key = 'markdown:isEnabledLinebreaks';
 
 
     // return default value if undefined
     // return default value if undefined
@@ -327,8 +310,7 @@ module.exports = function(crowi) {
     return config.markdown[key];
     return config.markdown[key];
   };
   };
 
 
-  configSchema.statics.isEnabledLinebreaksInComments = function(config)
-  {
+  configSchema.statics.isEnabledLinebreaksInComments = function(config) {
     const key = 'markdown:isEnabledLinebreaksInComments';
     const key = 'markdown:isEnabledLinebreaksInComments';
 
 
     // return default value if undefined
     // return default value if undefined
@@ -342,46 +324,39 @@ module.exports = function(crowi) {
   /**
   /**
    * initialize custom css strings
    * initialize custom css strings
    */
    */
-  configSchema.statics.initCustomCss = function(config)
-  {
+  configSchema.statics.initCustomCss = function(config) {
     const key = 'customize:css';
     const key = 'customize:css';
     const rawCss = getValueForCrowiNS(config, key);
     const rawCss = getValueForCrowiNS(config, key);
     // uglify and store
     // uglify and store
     this._customCss = uglifycss.processString(rawCss);
     this._customCss = uglifycss.processString(rawCss);
-  }
+  };
 
 
-  configSchema.statics.customCss = function(config)
-  {
+  configSchema.statics.customCss = function(config) {
     return this._customCss;
     return this._customCss;
-  }
+  };
 
 
-  configSchema.statics.initCustomScript = function(config)
-  {
+  configSchema.statics.initCustomScript = function(config) {
     const key = 'customize:script';
     const key = 'customize:script';
     const rawScript = getValueForCrowiNS(config, key);
     const rawScript = getValueForCrowiNS(config, key);
     // store as is
     // store as is
     this._customScript = rawScript;
     this._customScript = rawScript;
-  }
+  };
 
 
-  configSchema.statics.customScript = function(config)
-  {
+  configSchema.statics.customScript = function(config) {
     return this._customScript;
     return this._customScript;
-  }
+  };
 
 
-  configSchema.statics.customHeader = function(config)
-  {
+  configSchema.statics.customHeader = function(config) {
     const key = 'customize:header';
     const key = 'customize:header';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
-  }
+  };
 
 
-  configSchema.statics.theme = function(config)
-  {
+  configSchema.statics.theme = function(config) {
     const key = 'customize:theme';
     const key = 'customize:theme';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
-  }
+  };
 
 
-  configSchema.statics.customTitle = function(config, page)
-  {
+  configSchema.statics.customTitle = function(config, page) {
     const key = 'customize:title';
     const key = 'customize:title';
     let customTitle = getValueForCrowiNS(config, key);
     let customTitle = getValueForCrowiNS(config, key);
 
 
@@ -392,52 +367,44 @@ module.exports = function(crowi) {
     return customTitle
     return customTitle
       .replace('{{sitename}}', this.appTitle(config))
       .replace('{{sitename}}', this.appTitle(config))
       .replace('{{page}}', page);
       .replace('{{page}}', page);
-  }
+  };
 
 
-  configSchema.statics.behaviorType = function(config)
-  {
+  configSchema.statics.behaviorType = function(config) {
     const key = 'customize:behavior';
     const key = 'customize:behavior';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
-  }
+  };
 
 
-  configSchema.statics.layoutType = function(config)
-  {
+  configSchema.statics.layoutType = function(config) {
     const key = 'customize:layout';
     const key = 'customize:layout';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
-  }
+  };
 
 
-  configSchema.statics.highlightJsStyle = function(config)
-  {
+  configSchema.statics.highlightJsStyle = function(config) {
     const key = 'customize:highlightJsStyle';
     const key = 'customize:highlightJsStyle';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
-  }
+  };
 
 
-  configSchema.statics.highlightJsStyleBorder = function(config)
-  {
+  configSchema.statics.highlightJsStyleBorder = function(config) {
     const key = 'customize:highlightJsStyleBorder';
     const key = 'customize:highlightJsStyleBorder';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
-  }
+  };
 
 
-  configSchema.statics.isEnabledTimeline = function(config)
-  {
+  configSchema.statics.isEnabledTimeline = function(config) {
     const key = 'customize:isEnabledTimeline';
     const key = 'customize:isEnabledTimeline';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
   };
   };
 
 
-  configSchema.statics.isSavedStatesOfTabChanges = function(config)
-  {
+  configSchema.statics.isSavedStatesOfTabChanges = function(config) {
     const key = 'customize:isSavedStatesOfTabChanges';
     const key = 'customize:isSavedStatesOfTabChanges';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
   };
   };
 
 
-  configSchema.statics.isEnabledAttachTitleHeader = function(config)
-  {
+  configSchema.statics.isEnabledAttachTitleHeader = function(config) {
     const key = 'customize:isEnabledAttachTitleHeader';
     const key = 'customize:isEnabledAttachTitleHeader';
     return getValueForCrowiNS(config, key);
     return getValueForCrowiNS(config, key);
   };
   };
 
 
-  configSchema.statics.fileUploadEnabled = function(config)
-  {
+  configSchema.statics.fileUploadEnabled = function(config) {
     const Config = this;
     const Config = this;
 
 
     if (!Config.isUploadable(config)) {
     if (!Config.isUploadable(config)) {
@@ -448,32 +415,28 @@ module.exports = function(crowi) {
     return !!config.crowi['app:fileUpload'];
     return !!config.crowi['app:fileUpload'];
   };
   };
 
 
-  configSchema.statics.hasSlackConfig = function(config)
-  {
+  configSchema.statics.hasSlackConfig = function(config) {
     return Config.hasSlackToken(config) || Config.hasSlackIwhUrl(config);
     return Config.hasSlackToken(config) || Config.hasSlackIwhUrl(config);
   };
   };
 
 
   /**
   /**
    * for Slack Incoming Webhooks
    * for Slack Incoming Webhooks
    */
    */
-  configSchema.statics.hasSlackIwhUrl = function(config)
-  {
+  configSchema.statics.hasSlackIwhUrl = function(config) {
     if (!config.notification) {
     if (!config.notification) {
       return false;
       return false;
     }
     }
     return (config.notification['slack:incomingWebhookUrl'] ? true : false);
     return (config.notification['slack:incomingWebhookUrl'] ? true : false);
   };
   };
 
 
-  configSchema.statics.isIncomingWebhookPrioritized = function(config)
-  {
+  configSchema.statics.isIncomingWebhookPrioritized = function(config) {
     if (!config.notification) {
     if (!config.notification) {
       return false;
       return false;
     }
     }
     return (config.notification['slack:isIncomingWebhookPrioritized'] ? true : false);
     return (config.notification['slack:isIncomingWebhookPrioritized'] ? true : false);
   };
   };
 
 
-  configSchema.statics.hasSlackToken = function(config)
-  {
+  configSchema.statics.hasSlackToken = function(config) {
     if (!config.notification) {
     if (!config.notification) {
       return false;
       return false;
     }
     }
@@ -481,8 +444,7 @@ module.exports = function(crowi) {
     return (config.notification['slack:token'] ? true : false);
     return (config.notification['slack:token'] ? true : false);
   };
   };
 
 
-  configSchema.statics.getLocalconfig = function(config)
-  {
+  configSchema.statics.getLocalconfig = function(config) {
     const Config = this;
     const Config = this;
     const env = crowi.getEnv();
     const env = crowi.getEnv();
 
 
@@ -506,7 +468,7 @@ module.exports = function(crowi) {
     };
     };
 
 
     return local_config;
     return local_config;
-  }
+  };
 
 
   /*
   /*
   configSchema.statics.isInstalled = function(config)
   configSchema.statics.isInstalled = function(config)

+ 2 - 2
lib/models/external-account.js

@@ -55,7 +55,7 @@ class ExternalAccount {
     return this.populate('user').execPopulate()
     return this.populate('user').execPopulate()
       .then((account) => {
       .then((account) => {
         return account.user;
         return account.user;
-      })
+      });
   }
   }
 
 
   /**
   /**
@@ -154,4 +154,4 @@ module.exports = function(crowi) {
   ExternalAccount.crowi = crowi;
   ExternalAccount.crowi = crowi;
   schema.loadClass(ExternalAccount);
   schema.loadClass(ExternalAccount);
   return mongoose.model('ExternalAccount', schema);
   return mongoose.model('ExternalAccount', schema);
-}
+};

+ 9 - 9
lib/models/page-group-relation.js

@@ -26,16 +26,16 @@ schema.plugin(mongoosePaginate);
  */
  */
 class PageGroupRelation {
 class PageGroupRelation {
 
 
-    /**
+  /**
    * limit items num for pagination
    * limit items num for pagination
    *
    *
    * @readonly
    * @readonly
    * @static
    * @static
    * @memberof PageGroupRelation
    * @memberof PageGroupRelation
    */
    */
-   static get PAGE_ITEMS() {
-     return 50;
-    }
+  static get PAGE_ITEMS() {
+    return 50;
+  }
 
 
   static set crowi(crowi) {
   static set crowi(crowi) {
     this._crowi = crowi;
     this._crowi = crowi;
@@ -164,11 +164,11 @@ class PageGroupRelation {
     return this.findByPage(pageData)
     return this.findByPage(pageData)
       .then((pageRelations) => {
       .then((pageRelations) => {
         return pageRelations.map((pageRelation) => {
         return pageRelations.map((pageRelation) => {
-          return UserGroupRelation.isRelatedUserForGroup(userData, pageRelation.relatedGroup)
+          return UserGroupRelation.isRelatedUserForGroup(userData, pageRelation.relatedGroup);
         });
         });
       })
       })
       .then((checkPromises) => {
       .then((checkPromises) => {
-        return Promise.all(checkPromises)
+        return Promise.all(checkPromises);
       })
       })
       .then((checkResults) => {
       .then((checkResults) => {
         var checkResult = false;
         var checkResult = false;
@@ -198,7 +198,7 @@ class PageGroupRelation {
       relatedGroup: userGroup.id,
       relatedGroup: userGroup.id,
       targetPage: page.id,
       targetPage: page.id,
     });
     });
-  };
+  }
 
 
   /**
   /**
    * remove all relation for UserGroup
    * remove all relation for UserGroup
@@ -273,8 +273,8 @@ class PageGroupRelation {
   }
   }
 }
 }
 
 
-module.exports = function (crowi) {
+module.exports = function(crowi) {
   PageGroupRelation.crowi = crowi;
   PageGroupRelation.crowi = crowi;
   schema.loadClass(PageGroupRelation);
   schema.loadClass(PageGroupRelation);
   return mongoose.model('PageGroupRelation', schema);
   return mongoose.model('PageGroupRelation', schema);
-}
+};

+ 139 - 131
lib/models/page.js

@@ -48,7 +48,8 @@ module.exports = function(crowi) {
       get: function(data) {
       get: function(data) {
         try {
         try {
           return JSON.parse(data);
           return JSON.parse(data);
-        } catch(e) {
+        }
+        catch (e) {
           return data;
           return data;
         }
         }
       },
       },
@@ -103,8 +104,9 @@ module.exports = function(crowi) {
 
 
     if (this.populated('creator') && this.creator._id.toString() === userData._id.toString()) {
     if (this.populated('creator') && this.creator._id.toString() === userData._id.toString()) {
       return true;
       return true;
-    } else if (this.creator.toString() === userData._id.toString()) {
-      return true
+    }
+    else if (this.creator.toString() === userData._id.toString()) {
+      return true;
     }
     }
 
 
     return false;
     return false;
@@ -149,21 +151,22 @@ module.exports = function(crowi) {
     var self = this,
     var self = this,
       Page = self;
       Page = self;
 
 
-      return new Promise(function(resolve, reject) {
-        var added = self.liker.addToSet(userData._id);
-        if (added.length > 0) {
-          self.save(function(err, data) {
-            if (err) {
-              return reject(err);
-            }
-            debug('liker updated!', added);
-            return resolve(data);
-          });
-        } else {
-          debug('liker not updated');
-          return reject(self);
-        }
-      });
+    return new Promise(function(resolve, reject) {
+      var added = self.liker.addToSet(userData._id);
+      if (added.length > 0) {
+        self.save(function(err, data) {
+          if (err) {
+            return reject(err);
+          }
+          debug('liker updated!', added);
+          return resolve(data);
+        });
+      }
+      else {
+        debug('liker not updated');
+        return reject(self);
+      }
+    });
 
 
   };
   };
 
 
@@ -171,21 +174,22 @@ module.exports = function(crowi) {
     var self = this,
     var self = this,
       Page = self;
       Page = self;
 
 
-      return new Promise(function(resolve, reject) {
-        var beforeCount = self.liker.length;
-        self.liker.pull(userData._id);
-        if (self.liker.length != beforeCount) {
-          self.save(function(err, data) {
-            if (err) {
-              return reject(err);
-            }
-            return resolve(data);
-          });
-        } else {
-          debug('liker not updated');
-          return reject(self);
-        }
-      });
+    return new Promise(function(resolve, reject) {
+      var beforeCount = self.liker.length;
+      self.liker.pull(userData._id);
+      if (self.liker.length != beforeCount) {
+        self.save(function(err, data) {
+          if (err) {
+            return reject(err);
+          }
+          return resolve(data);
+        });
+      }
+      else {
+        debug('liker not updated');
+        return reject(self);
+      }
+    });
 
 
   };
   };
 
 
@@ -193,35 +197,35 @@ module.exports = function(crowi) {
     var self = this,
     var self = this,
       Page = self;
       Page = self;
 
 
-      return this.seenUsers.some(function(seenUser) {
-        return seenUser.equals(userData._id);
-      });
+    return this.seenUsers.some(function(seenUser) {
+      return seenUser.equals(userData._id);
+    });
   };
   };
 
 
   pageSchema.methods.seen = function(userData) {
   pageSchema.methods.seen = function(userData) {
     var self = this,
     var self = this,
       Page = self;
       Page = self;
 
 
-      if (this.isSeenUser(userData)) {
-        debug('seenUsers not updated');
-        return Promise.resolve(this);
+    if (this.isSeenUser(userData)) {
+      debug('seenUsers not updated');
+      return Promise.resolve(this);
+    }
+
+    return new Promise(function(resolve, reject) {
+      if (!userData || !userData._id) {
+        reject(new Error('User data is not valid'));
       }
       }
 
 
-      return new Promise(function(resolve, reject) {
-        if (!userData || !userData._id) {
-          reject(new Error('User data is not valid'));
+      var added = self.seenUsers.addToSet(userData);
+      self.save(function(err, data) {
+        if (err) {
+          return reject(err);
         }
         }
 
 
-        var added = self.seenUsers.addToSet(userData);
-        self.save(function(err, data) {
-          if (err) {
-            return reject(err);
-          }
-
-          debug('seenUsers updated!', added);
-          return resolve(self);
-        });
+        debug('seenUsers updated!', added);
+        return resolve(self);
       });
       });
+    });
   };
   };
 
 
   pageSchema.methods.getSlackChannel = function() {
   pageSchema.methods.getSlackChannel = function() {
@@ -271,7 +275,7 @@ module.exports = function(crowi) {
         {path: 'revision', model: 'Revision'},
         {path: 'revision', model: 'Revision'},
         //{path: 'liker', options: { limit: 11 }},
         //{path: 'liker', options: { limit: 11 }},
         //{path: 'seenUsers', options: { limit: 11 }},
         //{path: 'seenUsers', options: { limit: 11 }},
-      ], function (err, pageData) {
+      ], function(err, pageData) {
         Page.populate(pageData, {path: 'revision.author', model: 'User', select: User.USER_PUBLIC_FIELDS}, function(err, data) {
         Page.populate(pageData, {path: 'revision.author', model: 'User', select: User.USER_PUBLIC_FIELDS}, function(err, data) {
           if (err) {
           if (err) {
             return reject(err);
             return reject(err);
@@ -307,10 +311,9 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  pageSchema.statics.updateCommentCount = function (pageId)
-  {
+  pageSchema.statics.updateCommentCount = function(pageId) {
     var self = this;
     var self = this;
-    var Comment = crowi.model("Comment");
+    var Comment = crowi.model('Comment');
     return Comment.countCommentByPageId(pageId)
     return Comment.countCommentByPageId(pageId)
     .then(function(count) {
     .then(function(count) {
       self.update({_id: pageId}, {commentCount: count}, {}, function(err, data) {
       self.update({_id: pageId}, {commentCount: count}, {}, function(err, data) {
@@ -324,7 +327,7 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  pageSchema.statics.hasPortalPage = function (path, user, revisionId) {
+  pageSchema.statics.hasPortalPage = function(path, user, revisionId) {
     var self = this;
     var self = this;
     return new Promise(function(resolve, reject) {
     return new Promise(function(resolve, reject) {
       self.findPage(path, user, revisionId)
       self.findPage(path, user, revisionId)
@@ -416,7 +419,7 @@ module.exports = function(crowi) {
   pageSchema.statics.fixToCreatableName = function(path) {
   pageSchema.statics.fixToCreatableName = function(path) {
     return path
     return path
       .replace(/\/\//g, '/')
       .replace(/\/\//g, '/')
-      ;
+    ;
   };
   };
 
 
   pageSchema.statics.updateRevision = function(pageId, revisionId, cb) {
   pageSchema.statics.updateRevision = function(pageId, revisionId, cb) {
@@ -497,22 +500,23 @@ module.exports = function(crowi) {
             return resolve(null);
             return resolve(null);
           }
           }
 
 
-          var pageNotFoundError = new Error('Page Not Found')
+          var pageNotFoundError = new Error('Page Not Found');
           pageNotFoundError.name = 'Crowi:Page:NotFound';
           pageNotFoundError.name = 'Crowi:Page:NotFound';
           return reject(pageNotFoundError);
           return reject(pageNotFoundError);
         }
         }
 
 
         if (!pageData.isGrantedFor(userData)) {
         if (!pageData.isGrantedFor(userData)) {
           PageGroupRelation.isExistsGrantedGroupForPageAndUser(pageData, userData)
           PageGroupRelation.isExistsGrantedGroupForPageAndUser(pageData, userData)
-            .then(function (checkResult) {
+            .then(function(checkResult) {
               if (!checkResult) {
               if (!checkResult) {
                 return reject(new Error('Page is not granted for the user')); //PAGE_GRANT_ERROR, null);
                 return reject(new Error('Page is not granted for the user')); //PAGE_GRANT_ERROR, null);
-              } else {
+              }
+              else {
                 // return resolve(pageData);
                 // return resolve(pageData);
                 self.populatePageData(pageData, revisionId || null).then(resolve).catch(reject);
                 self.populatePageData(pageData, revisionId || null).then(resolve).catch(reject);
               }
               }
             })
             })
-            .catch(function (err) {
+            .catch(function(err) {
               return reject(err);
               return reject(err);
             });
             });
         }
         }
@@ -625,7 +629,7 @@ module.exports = function(crowi) {
     var Page = this
     var Page = this
       , options = options || {}
       , options = options || {}
       , publicOnly = options.publicOnly || true
       , publicOnly = options.publicOnly || true
-      , criteria = {redirectTo: null,}
+      , criteria = {redirectTo: null, }
       ;
       ;
 
 
     if (publicOnly) {
     if (publicOnly) {
@@ -697,7 +701,7 @@ module.exports = function(crowi) {
           Page.populate(pages, {path: 'revision.author', model: 'User', select: User.USER_PUBLIC_FIELDS})
           Page.populate(pages, {path: 'revision.author', model: 'User', select: User.USER_PUBLIC_FIELDS})
           .then(resolve)
           .then(resolve)
           .catch(reject);
           .catch(reject);
-        })
+        });
     });
     });
   };
   };
 
 
@@ -753,7 +757,7 @@ module.exports = function(crowi) {
         {grant: GRANT_RESTRICTED, grantedUsers: userData._id},
         {grant: GRANT_RESTRICTED, grantedUsers: userData._id},
         {grant: GRANT_SPECIFIED, grantedUsers: userData._id},
         {grant: GRANT_SPECIFIED, grantedUsers: userData._id},
         {grant: GRANT_OWNER, grantedUsers: userData._id},
         {grant: GRANT_OWNER, grantedUsers: userData._id},
-      ],})
+      ], })
       .and({
       .and({
         $or: pathCondition
         $or: pathCondition
       });
       });
@@ -768,7 +772,7 @@ module.exports = function(crowi) {
     }
     }
 
 
     return q;
     return q;
-  }
+  };
 
 
   pageSchema.statics.updatePageProperty = function(page, updateData) {
   pageSchema.statics.updatePageProperty = function(page, updateData) {
     var Page = this;
     var Page = this;
@@ -784,7 +788,7 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  pageSchema.statics.updateGrant = function (page, grant, userData, grantUserGroupId) {
+  pageSchema.statics.updateGrant = function(page, grant, userData, grantUserGroupId) {
     var Page = this;
     var Page = this;
 
 
     if (grant == GRANT_USER_GROUP && grantUserGroupId == null) {
     if (grant == GRANT_USER_GROUP && grantUserGroupId == null) {
@@ -794,7 +798,8 @@ module.exports = function(crowi) {
       page.grant = grant;
       page.grant = grant;
       if (grant == GRANT_PUBLIC || grant == GRANT_USER_GROUP) {
       if (grant == GRANT_PUBLIC || grant == GRANT_USER_GROUP) {
         page.grantedUsers = [];
         page.grantedUsers = [];
-      } else {
+      }
+      else {
         page.grantedUsers = [];
         page.grantedUsers = [];
         page.grantedUsers.push(userData._id);
         page.grantedUsers.push(userData._id);
       }
       }
@@ -813,7 +818,7 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  pageSchema.statics.updateGrantUserGroup = function (page, grant, grantUserGroupId, userData) {
+  pageSchema.statics.updateGrantUserGroup = function(page, grant, grantUserGroupId, userData) {
     var UserGroupRelation = crowi.model('UserGroupRelation');
     var UserGroupRelation = crowi.model('UserGroupRelation');
     var PageGroupRelation = crowi.model('PageGroupRelation');
     var PageGroupRelation = crowi.model('PageGroupRelation');
 
 
@@ -897,50 +902,50 @@ module.exports = function(crowi) {
       , grantUserGroupId = options.grantUserGroupId || null;
       , grantUserGroupId = options.grantUserGroupId || null;
 
 
     // force public
     // force public
-      if (isPortalPath(path)) {
-        grant = GRANT_PUBLIC;
-      }
+    if (isPortalPath(path)) {
+      grant = GRANT_PUBLIC;
+    }
 
 
-      return new Promise(function(resolve, reject) {
-        Page.findOne({path: path}, function(err, pageData) {
-          if (pageData) {
-            return reject(new Error('Cannot create new page to existed path'));
-          }
+    return new Promise(function(resolve, reject) {
+      Page.findOne({path: path}, function(err, pageData) {
+        if (pageData) {
+          return reject(new Error('Cannot create new page to existed path'));
+        }
 
 
-          var newPage = new Page();
-          newPage.path = path;
-          newPage.creator = user;
-          newPage.lastUpdateUser = user;
-          newPage.createdAt = Date.now();
-          newPage.updatedAt = Date.now();
-          newPage.redirectTo = redirectTo;
-          newPage.grant = grant;
-          newPage.status = STATUS_PUBLISHED;
-          newPage.grantedUsers = [];
-          newPage.grantedUsers.push(user);
-
-          newPage.save(function (err, newPage) {
-            if (err) {
-              return reject(err);
-            }
+        var newPage = new Page();
+        newPage.path = path;
+        newPage.creator = user;
+        newPage.lastUpdateUser = user;
+        newPage.createdAt = Date.now();
+        newPage.updatedAt = Date.now();
+        newPage.redirectTo = redirectTo;
+        newPage.grant = grant;
+        newPage.status = STATUS_PUBLISHED;
+        newPage.grantedUsers = [];
+        newPage.grantedUsers.push(user);
+
+        newPage.save(function(err, newPage) {
+          if (err) {
+            return reject(err);
+          }
 
 
-            if (newPage.grant == Page.GRANT_USER_GROUP && grantUserGroupId != null) {
-              Page.updateGrantUserGroup(newPage, grant, grantUserGroupId, user)
+          if (newPage.grant == Page.GRANT_USER_GROUP && grantUserGroupId != null) {
+            Page.updateGrantUserGroup(newPage, grant, grantUserGroupId, user)
               .catch((err) => {
               .catch((err) => {
                 return reject(err);
                 return reject(err);
               });
               });
-            }
-            var newRevision = Revision.prepareRevision(newPage, body, user, {format: format});
-            Page.pushRevision(newPage, newRevision, user).then(function(data) {
-              resolve(data);
-              pageEvent.emit('create', data, user);
-            }).catch(function(err) {
-              debug('Push Revision Error on create page', err);
-              return reject(err);
-            });
+          }
+          var newRevision = Revision.prepareRevision(newPage, body, user, {format: format});
+          Page.pushRevision(newPage, newRevision, user).then(function(data) {
+            resolve(data);
+            pageEvent.emit('create', data, user);
+          }).catch(function(err) {
+            debug('Push Revision Error on create page', err);
+            return reject(err);
           });
           });
         });
         });
       });
       });
+    });
   };
   };
 
 
   pageSchema.statics.updatePage = function(pageData, body, user, options) {
   pageSchema.statics.updatePage = function(pageData, body, user, options) {
@@ -961,7 +966,8 @@ module.exports = function(crowi) {
             resolve(data);
             resolve(data);
             pageEvent.emit('update', data, user);
             pageEvent.emit('update', data, user);
           });
           });
-        } else {
+        }
+        else {
           resolve(pageData);
           resolve(pageData);
           pageEvent.emit('update', pageData, user);
           pageEvent.emit('update', pageData, user);
         }
         }
@@ -986,30 +992,31 @@ module.exports = function(crowi) {
           // が、 /trash 以下にページが有るのは、個別に作っていたケースのみ。
           // が、 /trash 以下にページが有るのは、個別に作っていたケースのみ。
           // 一応しばらく前から uncreatable pages になっているのでこれでいいことにする
           // 一応しばらく前から uncreatable pages になっているのでこれでいいことにする
           debug('Deleted the page, and rename it', pageData.path, newPath);
           debug('Deleted the page, and rename it', pageData.path, newPath);
-          return Page.rename(pageData, newPath, user, {createRedirectPage: true})
+          return Page.rename(pageData, newPath, user, {createRedirectPage: true});
         }).then(function(pageData) {
         }).then(function(pageData) {
           resolve(pageData);
           resolve(pageData);
         }).catch(reject);
         }).catch(reject);
       });
       });
-    } else {
+    }
+    else {
       return Promise.reject('Page is not deletable.');
       return Promise.reject('Page is not deletable.');
     }
     }
   };
   };
 
 
-  pageSchema.statics.deletePageRecursively = function (pageData, user, options) {
+  pageSchema.statics.deletePageRecursively = function(pageData, user, options) {
     var Page = this
     var Page = this
       , path = pageData.path
       , path = pageData.path
       , options = options || {}
       , options = options || {}
       ;
       ;
 
 
-    return new Promise(function (resolve, reject) {
+    return new Promise(function(resolve, reject) {
       Page
       Page
       .generateQueryToListWithDescendants(path, user, options)
       .generateQueryToListWithDescendants(path, user, options)
-      .then(function (pages) {
-        Promise.all(pages.map(function (page) {
+      .then(function(pages) {
+        Promise.all(pages.map(function(page) {
           return Page.deletePage(page, user, options);
           return Page.deletePage(page, user, options);
         }))
         }))
-        .then(function (data) {
+        .then(function(data) {
           return resolve(pageData);
           return resolve(pageData);
         });
         });
       });
       });
@@ -1034,12 +1041,12 @@ module.exports = function(crowi) {
 
 
         return Page.completelyDeletePage(originPageData);
         return Page.completelyDeletePage(originPageData);
       }).then(function(done) {
       }).then(function(done) {
-        return Page.updatePageProperty(pageData, {status: STATUS_PUBLISHED, lastUpdateUser: user})
+        return Page.updatePageProperty(pageData, {status: STATUS_PUBLISHED, lastUpdateUser: user});
       }).then(function(done) {
       }).then(function(done) {
         pageData.status = STATUS_PUBLISHED;
         pageData.status = STATUS_PUBLISHED;
 
 
         debug('Revert deleted the page, and rename again it', pageData, newPath);
         debug('Revert deleted the page, and rename again it', pageData, newPath);
-        return Page.rename(pageData, newPath, user, {})
+        return Page.rename(pageData, newPath, user, {});
       }).then(function(done) {
       }).then(function(done) {
         pageData.path = newPath;
         pageData.path = newPath;
         resolve(pageData);
         resolve(pageData);
@@ -1047,25 +1054,25 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  pageSchema.statics.revertDeletedPageRecursively = function (pageData, user, options) {
+  pageSchema.statics.revertDeletedPageRecursively = function(pageData, user, options) {
     var Page = this
     var Page = this
       , path = pageData.path
       , path = pageData.path
       , options = options || { includeDeletedPage: true}
       , options = options || { includeDeletedPage: true}
       ;
       ;
 
 
-      return new Promise(function (resolve, reject) {
-        Page
+    return new Promise(function(resolve, reject) {
+      Page
         .generateQueryToListWithDescendants(path, user, options)
         .generateQueryToListWithDescendants(path, user, options)
-        .then(function (pages) {
-          Promise.all(pages.map(function (page) {
+        .then(function(pages) {
+          Promise.all(pages.map(function(page) {
             return Page.revertDeletedPage(page, user, options);
             return Page.revertDeletedPage(page, user, options);
           }))
           }))
-          .then(function (data) {
+          .then(function(data) {
             return resolve(data[0]);
             return resolve(data[0]);
           });
           });
         });
         });
-      });
-    };
+    });
+  };
 
 
   /**
   /**
    * This is danger.
    * This is danger.
@@ -1102,21 +1109,21 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  pageSchema.statics.completelyDeletePageRecursively = function (pageData, user, options) {
+  pageSchema.statics.completelyDeletePageRecursively = function(pageData, user, options) {
     // Delete Bookmarks, Attachments, Revisions, Pages and emit delete
     // Delete Bookmarks, Attachments, Revisions, Pages and emit delete
     var Page = this
     var Page = this
       , path = pageData.path
       , path = pageData.path
       , options = options || { includeDeletedPage: true }
       , options = options || { includeDeletedPage: true }
       ;
       ;
 
 
-    return new Promise(function (resolve, reject) {
+    return new Promise(function(resolve, reject) {
       Page
       Page
       .generateQueryToListWithDescendants(path, user, options)
       .generateQueryToListWithDescendants(path, user, options)
-      .then(function (pages) {
-        Promise.all(pages.map(function (page) {
+      .then(function(pages) {
+        Promise.all(pages.map(function(page) {
           return Page.completelyDeletePage(page, user, options);
           return Page.completelyDeletePage(page, user, options);
         }))
         }))
-        .then(function (data) {
+        .then(function(data) {
           return resolve(data[0]);
           return resolve(data[0]);
         });
         });
       });
       });
@@ -1166,13 +1173,13 @@ module.exports = function(crowi) {
         return Page.removePageById(redirectOriginPageData.id)
         return Page.removePageById(redirectOriginPageData.id)
           // remove recursive
           // remove recursive
           .then(() => {
           .then(() => {
-            return Page.removeRedirectOriginPageByPath(redirectOriginPageData.path)
+            return Page.removeRedirectOriginPageByPath(redirectOriginPageData.path);
           });
           });
       })
       })
       .catch((err) => {
       .catch((err) => {
         // do nothing if origin page doesn't exist
         // do nothing if origin page doesn't exist
         return Promise.resolve();
         return Promise.resolve();
-      })
+      });
   };
   };
 
 
   pageSchema.statics.rename = function(pageData, newPagePath, user, options) {
   pageSchema.statics.rename = function(pageData, newPagePath, user, options) {
@@ -1187,14 +1194,15 @@ module.exports = function(crowi) {
       Page.updatePageProperty(pageData, {updatedAt: Date.now(), path: newPagePath, lastUpdateUser: user})
       Page.updatePageProperty(pageData, {updatedAt: Date.now(), path: newPagePath, lastUpdateUser: user})
       .then(function(data) {
       .then(function(data) {
         // reivisions の path を変更
         // reivisions の path を変更
-        return Revision.updateRevisionListByPath(path, {path: newPagePath}, {})
+        return Revision.updateRevisionListByPath(path, {path: newPagePath}, {});
       }).then(function(data) {
       }).then(function(data) {
         pageData.path = newPagePath;
         pageData.path = newPagePath;
 
 
         if (createRedirectPage) {
         if (createRedirectPage) {
           var body = 'redirect ' + newPagePath;
           var body = 'redirect ' + newPagePath;
           Page.create(path, body, user, {redirectTo: newPagePath}).then(resolve).catch(reject);
           Page.create(path, body, user, {redirectTo: newPagePath}).then(resolve).catch(reject);
-        } else {
+        }
+        else {
           resolve(data);
           resolve(data);
         }
         }
         pageEvent.emit('update', pageData, user); // update as renamed page
         pageEvent.emit('update', pageData, user); // update as renamed page
@@ -1237,7 +1245,7 @@ module.exports = function(crowi) {
       returnPath += '/';
       returnPath += '/';
     }
     }
     return returnPath;
     return returnPath;
-  }
+  };
 
 
   pageSchema.statics.GRANT_PUBLIC = GRANT_PUBLIC;
   pageSchema.statics.GRANT_PUBLIC = GRANT_PUBLIC;
   pageSchema.statics.GRANT_RESTRICTED = GRANT_RESTRICTED;
   pageSchema.statics.GRANT_RESTRICTED = GRANT_RESTRICTED;

+ 14 - 21
lib/models/updatePost.js

@@ -18,13 +18,11 @@ module.exports = function(crowi) {
     createdAt: { type: Date, default: Date.now }
     createdAt: { type: Date, default: Date.now }
   });
   });
 
 
-  updatePostSchema.statics.normalizeChannelName = function(channel)
-  {
+  updatePostSchema.statics.normalizeChannelName = function(channel) {
     return channel.replace(/(#|,)/g, '');
     return channel.replace(/(#|,)/g, '');
-  }
+  };
 
 
-  updatePostSchema.statics.createPrefixesByPathPattern = function(pathPattern)
-  {
+  updatePostSchema.statics.createPrefixesByPathPattern = function(pathPattern) {
     var patternPrefix = ['*', '*'];
     var patternPrefix = ['*', '*'];
 
 
     // not begin with slash
     // not begin with slash
@@ -42,10 +40,9 @@ module.exports = function(crowi) {
       patternPrefix[1] = pattern[1];
       patternPrefix[1] = pattern[1];
     }
     }
     return patternPrefix;
     return patternPrefix;
-  }
+  };
 
 
-  updatePostSchema.statics.getRegExpByPattern = function(pattern)
-  {
+  updatePostSchema.statics.getRegExpByPattern = function(pattern) {
     var reg = pattern;
     var reg = pattern;
     if (!reg.match(/^\/.*/)) {
     if (!reg.match(/^\/.*/)) {
       reg = '/*' + reg + '*';
       reg = '/*' + reg + '*';
@@ -55,10 +52,9 @@ module.exports = function(crowi) {
     reg = reg.replace(/(\*)/g, '.*');
     reg = reg.replace(/(\*)/g, '.*');
 
 
     return new RegExp(reg);
     return new RegExp(reg);
-  }
+  };
 
 
-  updatePostSchema.statics.findSettingsByPath = function(path)
-  {
+  updatePostSchema.statics.findSettingsByPath = function(path) {
     var UpdatePost = this;
     var UpdatePost = this;
     var prefixes = UpdatePost.createPrefixesByPathPattern(path);
     var prefixes = UpdatePost.createPrefixesByPathPattern(path);
 
 
@@ -83,8 +79,7 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  updatePostSchema.statics.findAll = function(offset)
-  {
+  updatePostSchema.statics.findAll = function(offset) {
     var UpdatePost = this;
     var UpdatePost = this;
     var offset = offset || 0;
     var offset = offset || 0;
 
 
@@ -107,8 +102,7 @@ module.exports = function(crowi) {
     });
     });
   };
   };
 
 
-  updatePostSchema.statics.create = function(pathPattern, channel, user)
-  {
+  updatePostSchema.statics.create = function(pathPattern, channel, user) {
     var UpdatePost = this;
     var UpdatePost = this;
     var provider = 'slack'; // now slack only
     var provider = 'slack'; // now slack only
 
 
@@ -124,17 +118,16 @@ module.exports = function(crowi) {
 
 
     return new Promise(function(resolve, reject) {
     return new Promise(function(resolve, reject) {
       notif.save(function(err, doc) {
       notif.save(function(err, doc) {
-       if (err) {
-         return reject(err);
-       }
+        if (err) {
+          return reject(err);
+        }
 
 
-       return resolve(doc);
+        return resolve(doc);
       });
       });
     });
     });
   };
   };
 
 
-  updatePostSchema.statics.remove = function(id)
-  {
+  updatePostSchema.statics.remove = function(id) {
     var UpdatePost = this;
     var UpdatePost = this;
 
 
     return new Promise(function(resolve, reject) {
     return new Promise(function(resolve, reject) {

+ 6 - 6
lib/models/user-group-relation.js

@@ -54,7 +54,7 @@ class UserGroupRelation {
       .populate('relatedUser')
       .populate('relatedUser')
       .populate('relatedGroup')
       .populate('relatedGroup')
       .exec();
       .exec();
-  };
+  }
 
 
   /**
   /**
    * find all user and group relation of UserGroup
    * find all user and group relation of UserGroup
@@ -146,7 +146,7 @@ class UserGroupRelation {
     const query = {
     const query = {
       relatedGroup: userGroupId,
       relatedGroup: userGroupId,
       relatedUser: userData.id
       relatedUser: userData.id
-    }
+    };
 
 
     return this
     return this
       .findOne(query)
       .findOne(query)
@@ -173,7 +173,7 @@ class UserGroupRelation {
         });
         });
         const query = { _id: { $nin: relatedUserIds }, status: User.STATUS_ACTIVE };
         const query = { _id: { $nin: relatedUserIds }, status: User.STATUS_ACTIVE };
 
 
-        debug("findUserByNotRelatedGroup ", query);
+        debug('findUserByNotRelatedGroup ', query);
         return User.find(query).exec();
         return User.find(query).exec();
       });
       });
   }
   }
@@ -191,7 +191,7 @@ class UserGroupRelation {
     const query = {
     const query = {
       relatedGroup: userGroup.id,
       relatedGroup: userGroup.id,
       relatedUser: userData.id
       relatedUser: userData.id
-    }
+    };
 
 
     return this
     return this
       .count(query)
       .count(query)
@@ -272,8 +272,8 @@ class UserGroupRelation {
 
 
 }
 }
 
 
-module.exports = function (crowi) {
+module.exports = function(crowi) {
   UserGroupRelation.crowi = crowi;
   UserGroupRelation.crowi = crowi;
   schema.loadClass(UserGroupRelation);
   schema.loadClass(UserGroupRelation);
   return mongoose.model('UserGroupRelation', schema);
   return mongoose.model('UserGroupRelation', schema);
-}
+};

+ 8 - 8
lib/models/user-group.js

@@ -43,18 +43,18 @@ class UserGroup {
    * model static methods
    * model static methods
    */
    */
 
 
-   // グループ画像パスの生成
+  // グループ画像パスの生成
   static createUserGroupPictureFilePath(userGroup, name) {
   static createUserGroupPictureFilePath(userGroup, name) {
     var ext = '.' + name.match(/(.*)(?:\.([^.]+$))/)[2];
     var ext = '.' + name.match(/(.*)(?:\.([^.]+$))/)[2];
 
 
     return 'userGroup/' + userGroup._id + ext;
     return 'userGroup/' + userGroup._id + ext;
-  };
+  }
 
 
   // すべてのグループを取得(オプション指定可)
   // すべてのグループを取得(オプション指定可)
   static findAllGroups(option) {
   static findAllGroups(option) {
 
 
     return this.find().exec();
     return this.find().exec();
-  };
+  }
 
 
   /**
   /**
    * find all entities with pagination
    * find all entities with pagination
@@ -80,13 +80,13 @@ class UserGroup {
       .catch((err) => {
       .catch((err) => {
         debug('Error on pagination:', err);
         debug('Error on pagination:', err);
       });
       });
-  };
+  }
 
 
   // TBD: グループ名によるグループ検索
   // TBD: グループ名によるグループ検索
   static findUserGroupByName(name) {
   static findUserGroupByName(name) {
     const query = { name: name };
     const query = { name: name };
     return this.findOne(query);
     return this.findOne(query);
-  };
+  }
 
 
   // 登録可能グループ名確認
   // 登録可能グループ名確認
   static isRegisterableName(name) {
   static isRegisterableName(name) {
@@ -96,7 +96,7 @@ class UserGroup {
       .then((userGroupData) => {
       .then((userGroupData) => {
         return (userGroupData == null);
         return (userGroupData == null);
       });
       });
-  };
+  }
 
 
   // グループの完全削除
   // グループの完全削除
   static removeCompletelyById(id) {
   static removeCompletelyById(id) {
@@ -143,9 +143,9 @@ class UserGroup {
 }
 }
 
 
 
 
-module.exports = function (crowi) {
+module.exports = function(crowi) {
   UserGroup.crowi = crowi;
   UserGroup.crowi = crowi;
   schema.loadClass(UserGroup);
   schema.loadClass(UserGroup);
   return mongoose.model('UserGroup', schema);
   return mongoose.model('UserGroup', schema);
-}
+};
 
 

+ 38 - 36
lib/models/user.js

@@ -57,7 +57,7 @@ module.exports = function(crowi) {
 
 
   userEvent.on('activated', userEvent.onActivated);
   userEvent.on('activated', userEvent.onActivated);
 
 
-  function decideUserStatusOnRegistration () {
+  function decideUserStatusOnRegistration() {
     var Config = crowi.model('Config'),
     var Config = crowi.model('Config'),
       config = crowi.getConfig();
       config = crowi.getConfig();
 
 
@@ -79,10 +79,10 @@ module.exports = function(crowi) {
 
 
   function generateRandomEmail() {
   function generateRandomEmail() {
     const randomstr = generateRandomTempPassword();
     const randomstr = generateRandomTempPassword();
-    return `change-it-${randomstr}@example.com`
+    return `change-it-${randomstr}@example.com`;
   }
   }
 
 
-  function generateRandomTempPassword () {
+  function generateRandomTempPassword() {
     var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!=-_';
     var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!=-_';
     var password = '';
     var password = '';
     var len = 12;
     var len = 12;
@@ -95,14 +95,14 @@ module.exports = function(crowi) {
     return password;
     return password;
   }
   }
 
 
-  function generatePassword (password) {
+  function generatePassword(password) {
     var hasher = crypto.createHash('sha256');
     var hasher = crypto.createHash('sha256');
     hasher.update(crowi.env.PASSWORD_SEED + password);
     hasher.update(crowi.env.PASSWORD_SEED + password);
 
 
     return hasher.digest('hex');
     return hasher.digest('hex');
   }
   }
 
 
-  function generateApiToken (user) {
+  function generateApiToken(user) {
     var hasher = crypto.createHash('sha256');
     var hasher = crypto.createHash('sha256');
     hasher.update((new Date).getTime() + user._id);
     hasher.update((new Date).getTime() + user._id);
 
 
@@ -179,7 +179,8 @@ module.exports = function(crowi) {
       self.save(function(err, userData) {
       self.save(function(err, userData) {
         if (err) {
         if (err) {
           return reject(err);
           return reject(err);
-        } else {
+        }
+        else {
           return resolve(userData);
           return resolve(userData);
         }
         }
       });
       });
@@ -339,7 +340,7 @@ module.exports = function(crowi) {
       .sort(sort)
       .sort(sort)
       .skip(options.skip || 0)
       .skip(options.skip || 0)
       .limit(options.limit || 21)
       .limit(options.limit || 21)
-      .exec(function (err, userData) {
+      .exec(function(err, userData) {
         callback(err, userData);
         callback(err, userData);
       });
       });
 
 
@@ -360,10 +361,10 @@ module.exports = function(crowi) {
     return new Promise(function(resolve, reject) {
     return new Promise(function(resolve, reject) {
       User
       User
         .find()
         .find()
-        .or(status.map(s => { return {status: s}; }))
+        .or(status.map(s => { return {status: s} }))
         .select(fields)
         .select(fields)
         .sort(sort)
         .sort(sort)
-        .exec(function (err, userData) {
+        .exec(function(err, userData) {
           if (err) {
           if (err) {
             return reject(err);
             return reject(err);
           }
           }
@@ -387,7 +388,7 @@ module.exports = function(crowi) {
         .find({ _id: { $in: ids }, status: status })
         .find({ _id: { $in: ids }, status: status })
         .select(fields)
         .select(fields)
         .sort(sort)
         .sort(sort)
-        .exec(function (err, userData) {
+        .exec(function(err, userData) {
           if (err) {
           if (err) {
             return reject(err);
             return reject(err);
           }
           }
@@ -416,7 +417,7 @@ module.exports = function(crowi) {
       }
       }
 
 
       return callback(err, result);
       return callback(err, result);
-    }, { sortBy : sort });
+    }, { sortBy: sort });
   };
   };
 
 
   userSchema.statics.findUsersByPartOfEmail = function(emailPart, options) {
   userSchema.statics.findUsersByPartOfEmail = function(emailPart, options) {
@@ -462,7 +463,7 @@ module.exports = function(crowi) {
     if (googleId == null) {
     if (googleId == null) {
       callback(null, null);
       callback(null, null);
     }
     }
-    this.findOne({googleId}, function (err, userData) {
+    this.findOne({googleId}, function(err, userData) {
       callback(err, userData);
       callback(err, userData);
     });
     });
   };
   };
@@ -480,7 +481,7 @@ module.exports = function(crowi) {
 
 
   userSchema.statics.findUserByEmailAndPassword = function(email, password, callback) {
   userSchema.statics.findUserByEmailAndPassword = function(email, password, callback) {
     var hashedPassword = generatePassword(password);
     var hashedPassword = generatePassword(password);
-    this.findOne({email: email, password: hashedPassword}, function (err, userData) {
+    this.findOne({email: email, password: hashedPassword}, function(err, userData) {
       callback(err, userData);
       callback(err, userData);
     });
     });
   };
   };
@@ -489,7 +490,7 @@ module.exports = function(crowi) {
     var User = this;
     var User = this;
     var usernameUsable = true;
     var usernameUsable = true;
 
 
-    this.findOne({username: username}, function (err, userData) {
+    this.findOne({username: username}, function(err, userData) {
       if (userData) {
       if (userData) {
         usernameUsable = false;
         usernameUsable = false;
       }
       }
@@ -503,13 +504,13 @@ module.exports = function(crowi) {
     var usernameUsable = true;
     var usernameUsable = true;
 
 
     // username check
     // username check
-    this.findOne({username: username}, function (err, userData) {
+    this.findOne({username: username}, function(err, userData) {
       if (userData) {
       if (userData) {
         usernameUsable = false;
         usernameUsable = false;
       }
       }
 
 
       // email check
       // email check
-      User.findOne({email: email}, function (err, userData) {
+      User.findOne({email: email}, function(err, userData) {
         if (userData) {
         if (userData) {
           emailUsable = false;
           emailUsable = false;
         }
         }
@@ -525,7 +526,7 @@ module.exports = function(crowi) {
 
 
   userSchema.statics.removeCompletelyById = function(id, callback) {
   userSchema.statics.removeCompletelyById = function(id, callback) {
     var User = this;
     var User = this;
-    User.findById(id, function (err, userData) {
+    User.findById(id, function(err, userData) {
       if (!userData) {
       if (!userData) {
         return callback(err, null);
         return callback(err, null);
       }
       }
@@ -551,7 +552,7 @@ module.exports = function(crowi) {
     var User = this;
     var User = this;
 
 
     return new Promise(function(resolve, reject) {
     return new Promise(function(resolve, reject) {
-      User.findById(id, function (err, userData) {
+      User.findById(id, function(err, userData) {
         if (!userData) {
         if (!userData) {
           return reject(new Error('User not found'));
           return reject(new Error('User not found'));
         }
         }
@@ -587,13 +588,13 @@ module.exports = function(crowi) {
       emailList,
       emailList,
       function(email, next) {
       function(email, next) {
         var newUser = new User()
         var newUser = new User()
-          ,tmpUsername, password;
+          , tmpUsername, password;
 
 
         email = email.trim();
         email = email.trim();
 
 
         // email check
         // email check
         // TODO: 削除済みはチェック対象から外そう〜
         // TODO: 削除済みはチェック対象から外そう〜
-        User.findOne({email: email}, function (err, userData) {
+        User.findOne({email: email}, function(err, userData) {
           // The user is exists
           // The user is exists
           if (userData) {
           if (userData) {
             createdUserList.push({
             createdUserList.push({
@@ -622,7 +623,8 @@ module.exports = function(crowi) {
                 user: null,
                 user: null,
               });
               });
               debug('save failed!! ', err);
               debug('save failed!! ', err);
-            } else {
+            }
+            else {
               createdUserList.push({
               createdUserList.push({
                 email: email,
                 email: email,
                 password: password,
                 password: password,
@@ -650,20 +652,20 @@ module.exports = function(crowi) {
               }
               }
 
 
               mailer.send({
               mailer.send({
-                  to: user.email,
-                  subject: 'Invitation to ' + Config.appTitle(config),
-                  template: 'admin/userInvitation.txt',
-                  vars: {
-                    email: user.email,
-                    password: user.password,
-                    url: config.crowi['app:url'],
-                    appTitle: Config.appTitle(config),
-                  }
-                },
-                function (err, s) {
-                  debug('completed to send email: ', err, s);
-                  next();
+                to: user.email,
+                subject: 'Invitation to ' + Config.appTitle(config),
+                template: 'admin/userInvitation.txt',
+                vars: {
+                  email: user.email,
+                  password: user.password,
+                  url: config.crowi['app:url'],
+                  appTitle: Config.appTitle(config),
                 }
                 }
+              },
+              function(err, s) {
+                debug('completed to send email: ', err, s);
+                next();
+              }
               );
               );
             },
             },
             function(err) {
             function(err) {
@@ -705,7 +707,7 @@ module.exports = function(crowi) {
       }
       }
       return callback(err, userData);
       return callback(err, userData);
     });
     });
-  }
+  };
 
 
   /**
   /**
    * A wrapper function of createUserByEmailAndPasswordAndStatus
    * A wrapper function of createUserByEmailAndPasswordAndStatus
@@ -732,7 +734,7 @@ module.exports = function(crowi) {
         return resolve(userData);
         return resolve(userData);
       });
       });
     });
     });
-  }
+  };
 
 
   userSchema.statics.createUserPictureFilePath = function(user, name) {
   userSchema.statics.createUserPictureFilePath = function(user, name) {
     var ext = '.' + name.match(/(.*)(?:\.([^.]+$))/)[2];
     var ext = '.' + name.match(/(.*)(?:\.([^.]+$))/)[2];

+ 2 - 2
lib/plugins/plugin-utils-v2.js

@@ -32,9 +32,9 @@ class PluginUtilsV2 {
       name,
       name,
       meta,
       meta,
       entries,
       entries,
-    }
+    };
   }
   }
 
 
 }
 }
 
 
-module.exports = PluginUtilsV2
+module.exports = PluginUtilsV2;

+ 1 - 1
lib/plugins/plugin-utils.js

@@ -91,4 +91,4 @@ class PluginUtils {
   }
   }
 }
 }
 
 
-module.exports = PluginUtils
+module.exports = PluginUtils;

+ 97 - 80
lib/routes/admin.js

@@ -43,14 +43,16 @@ module.exports = function(crowi, app) {
     if (pagerMin === 1) {
     if (pagerMin === 1) {
       if (MAX_PAGE_LIST < pagesCount) {
       if (MAX_PAGE_LIST < pagesCount) {
         pagerMax = MAX_PAGE_LIST;
         pagerMax = MAX_PAGE_LIST;
-      } else {
+      }
+      else {
         pagerMax = pagesCount;
         pagerMax = pagesCount;
       }
       }
     }
     }
     if (pagerMax === pagesCount) {
     if (pagerMax === pagesCount) {
       if ((pagerMax - MAX_PAGE_LIST) < 1) {
       if ((pagerMax - MAX_PAGE_LIST) < 1) {
         pagerMin = 1;
         pagerMin = 1;
-      } else {
+      }
+      else {
         pagerMin = pagerMax - MAX_PAGE_LIST;
         pagerMin = pagerMax - MAX_PAGE_LIST;
       }
       }
     }
     }
@@ -121,7 +123,8 @@ module.exports = function(crowi, app) {
         req.flash('successMessage', ['Successfully updated!']);
         req.flash('successMessage', ['Successfully updated!']);
         return res.redirect('/admin/markdown');
         return res.redirect('/admin/markdown');
       });
       });
-    } else {
+    }
+    else {
       req.flash('errorMessage', req.form.errors);
       req.flash('errorMessage', req.form.errors);
       return res.redirect('/admin/markdown');
       return res.redirect('/admin/markdown');
     }
     }
@@ -134,17 +137,17 @@ module.exports = function(crowi, app) {
     settingForm = Config.setupCofigFormData('crowi', req.config);
     settingForm = Config.setupCofigFormData('crowi', req.config);
 
 
     const highlightJsCssSelectorOptions = {
     const highlightJsCssSelectorOptions = {
-      "github":           { name: '[Light] Github',         border: false },
-      "github-gist":      { name: '[Light] Github Gist',    border: true },
-      "atom-one-light":   { name: '[Light] Atom One Light', border: true },
-      "xcode":            { name: '[Light] Xcode',          border: true },
-      "vs":               { name: '[Light] Vs',             border: true },
-      "atom-one-dark":    { name: '[Dark] Atom One Dark',   border: false },
-      "hybrid":           { name: '[Dark] Hybrid',          border: false },
-      "monokai":          { name: '[Dark] Monokai',         border: false },
-      "tomorrow-night":   { name: '[Dark] Tomorrow Night',  border: false },
-      "vs2015":           { name: '[Dark] Vs 2015',         border: false },
-    }
+      'github':           { name: '[Light] Github',         border: false },
+      'github-gist':      { name: '[Light] Github Gist',    border: true },
+      'atom-one-light':   { name: '[Light] Atom One Light', border: true },
+      'xcode':            { name: '[Light] Xcode',          border: true },
+      'vs':               { name: '[Light] Vs',             border: true },
+      'atom-one-dark':    { name: '[Dark] Atom One Dark',   border: false },
+      'hybrid':           { name: '[Dark] Hybrid',          border: false },
+      'monokai':          { name: '[Dark] Monokai',         border: false },
+      'tomorrow-night':   { name: '[Dark] Tomorrow Night',  border: false },
+      'vs2015':           { name: '[Dark] Vs 2015',         border: false },
+    };
 
 
     return res.render('admin/customize', {
     return res.render('admin/customize', {
       settingForm: settingForm,
       settingForm: settingForm,
@@ -198,7 +201,8 @@ module.exports = function(crowi, app) {
           return res.redirect('/admin/notification');
           return res.redirect('/admin/notification');
         });
         });
       });
       });
-    } else {
+    }
+    else {
       req.flash('errorMessage', req.form.errors);
       req.flash('errorMessage', req.form.errors);
       return res.redirect('/admin/notification');
       return res.redirect('/admin/notification');
     }
     }
@@ -217,16 +221,17 @@ module.exports = function(crowi, app) {
     slack.getOauthAccessToken(code)
     slack.getOauthAccessToken(code)
     .then(data => {
     .then(data => {
       debug('oauth response', data);
       debug('oauth response', data);
-        Config.updateNamespaceByArray('notification', {'slack:token': data.access_token}, function(err, config) {
-          if (err) {
-            req.flash('errorMessage', ['Failed to save access_token. Please try again.']);
-          } else {
-            Config.updateConfigCache('notification', config);
-            req.flash('successMessage', ['Successfully Connected!']);
-          }
+      Config.updateNamespaceByArray('notification', {'slack:token': data.access_token}, function(err, config) {
+        if (err) {
+          req.flash('errorMessage', ['Failed to save access_token. Please try again.']);
+        }
+        else {
+          Config.updateConfigCache('notification', config);
+          req.flash('successMessage', ['Successfully Connected!']);
+        }
 
 
-          return res.redirect('/admin/notification');
-        });
+        return res.redirect('/admin/notification');
+      });
     }).catch(err => {
     }).catch(err => {
       debug('oauth response ERROR', err);
       debug('oauth response ERROR', err);
       req.flash('errorMessage', ['Failed to fetch access_token. Please do connect again.']);
       req.flash('errorMessage', ['Failed to fetch access_token. Please do connect again.']);
@@ -254,7 +259,8 @@ module.exports = function(crowi, app) {
           return res.redirect('/admin/notification#slack-incoming-webhooks');
           return res.redirect('/admin/notification#slack-incoming-webhooks');
         });
         });
       });
       });
-    } else {
+    }
+    else {
       req.flash('errorMessage', req.form.errors);
       req.flash('errorMessage', req.form.errors);
       return res.redirect('/admin/notification#slack-incoming-webhooks');
       return res.redirect('/admin/notification#slack-incoming-webhooks');
     }
     }
@@ -290,7 +296,7 @@ module.exports = function(crowi, app) {
         });
         });
     })
     })
     .then(function() {
     .then(function() {
-      return search.buildIndex()
+      return search.buildIndex();
     })
     })
     .then(function(data) {
     .then(function(data) {
       if (!data.errors) {
       if (!data.errors) {
@@ -302,7 +308,8 @@ module.exports = function(crowi, app) {
       if (!data.errors) {
       if (!data.errors) {
         debug('Data is successfully indexed.');
         debug('Data is successfully indexed.');
         req.flash('successMessage', 'Data is successfully indexed.');
         req.flash('successMessage', 'Data is successfully indexed.');
-      } else {
+      }
+      else {
         debug('Data index error.', data.errors);
         debug('Data index error.', data.errors);
         req.flash('errorMessage', `Data index error: ${data.errors}`);
         req.flash('errorMessage', `Data index error: ${data.errors}`);
       }
       }
@@ -336,12 +343,14 @@ module.exports = function(crowi, app) {
       User.createUsersByInvitation(form.emailList.split('\n'), toSendEmail, function(err, userList) {
       User.createUsersByInvitation(form.emailList.split('\n'), toSendEmail, function(err, userList) {
         if (err) {
         if (err) {
           req.flash('errorMessage', req.form.errors.join('\n'));
           req.flash('errorMessage', req.form.errors.join('\n'));
-        } else {
+        }
+        else {
           req.flash('createdUser', userList);
           req.flash('createdUser', userList);
         }
         }
         return res.redirect('/admin/users');
         return res.redirect('/admin/users');
       });
       });
-    } else {
+    }
+    else {
       req.flash('errorMessage', req.form.errors.join('\n'));
       req.flash('errorMessage', req.form.errors.join('\n'));
       return res.redirect('/admin/users');
       return res.redirect('/admin/users');
     }
     }
@@ -353,7 +362,8 @@ module.exports = function(crowi, app) {
       userData.makeAdmin(function(err, userData) {
       userData.makeAdmin(function(err, userData) {
         if (err === null) {
         if (err === null) {
           req.flash('successMessage', userData.name + 'さんのアカウントを管理者に設定しました。');
           req.flash('successMessage', userData.name + 'さんのアカウントを管理者に設定しました。');
-        } else {
+        }
+        else {
           req.flash('errorMessage', '更新に失敗しました。');
           req.flash('errorMessage', '更新に失敗しました。');
           debug(err, userData);
           debug(err, userData);
         }
         }
@@ -368,7 +378,8 @@ module.exports = function(crowi, app) {
       userData.removeFromAdmin(function(err, userData) {
       userData.removeFromAdmin(function(err, userData) {
         if (err === null) {
         if (err === null) {
           req.flash('successMessage', userData.name + 'さんのアカウントを管理者から外しました。');
           req.flash('successMessage', userData.name + 'さんのアカウントを管理者から外しました。');
-        } else {
+        }
+        else {
           req.flash('errorMessage', '更新に失敗しました。');
           req.flash('errorMessage', '更新に失敗しました。');
           debug(err, userData);
           debug(err, userData);
         }
         }
@@ -383,7 +394,8 @@ module.exports = function(crowi, app) {
       userData.statusActivate(function(err, userData) {
       userData.statusActivate(function(err, userData) {
         if (err === null) {
         if (err === null) {
           req.flash('successMessage', userData.name + 'さんのアカウントを有効化しました');
           req.flash('successMessage', userData.name + 'さんのアカウントを有効化しました');
-        } else {
+        }
+        else {
           req.flash('errorMessage', '更新に失敗しました。');
           req.flash('errorMessage', '更新に失敗しました。');
           debug(err, userData);
           debug(err, userData);
         }
         }
@@ -399,7 +411,8 @@ module.exports = function(crowi, app) {
       userData.statusSuspend(function(err, userData) {
       userData.statusSuspend(function(err, userData) {
         if (err === null) {
         if (err === null) {
           req.flash('successMessage', userData.name + 'さんのアカウントを利用停止にしました');
           req.flash('successMessage', userData.name + 'さんのアカウントを利用停止にしました');
-        } else {
+        }
+        else {
           req.flash('errorMessage', '更新に失敗しました。');
           req.flash('errorMessage', '更新に失敗しました。');
           debug(err, userData);
           debug(err, userData);
         }
         }
@@ -436,7 +449,7 @@ module.exports = function(crowi, app) {
           throw new Error(err.message);
           throw new Error(err.message);
         }
         }
         return userData;
         return userData;
-      })
+      });
     })
     })
     .then((userData) => {
     .then((userData) => {
       return Page.removePageByPath(`/user/${username}`)
       return Page.removePageByPath(`/user/${username}`)
@@ -461,7 +474,8 @@ module.exports = function(crowi, app) {
       if (err) {
       if (err) {
         debug('Error while removing user.', err, id);
         debug('Error while removing user.', err, id);
         req.flash('errorMessage', '完全な削除に失敗しました。');
         req.flash('errorMessage', '完全な削除に失敗しました。');
-      } else {
+      }
+      else {
         req.flash('successMessage', '削除しました');
         req.flash('successMessage', '削除しました');
       }
       }
       return res.redirect('/admin/users');
       return res.redirect('/admin/users');
@@ -481,7 +495,7 @@ module.exports = function(crowi, app) {
       debug('Error on reseting password', err);
       debug('Error on reseting password', err);
       return res.json(ApiResponse.error('Error'));
       return res.json(ApiResponse.error('Error'));
     });
     });
-  }
+  };
 
 
   actions.externalAccount = {};
   actions.externalAccount = {};
   actions.externalAccount.index = function(req, res) {
   actions.externalAccount.index = function(req, res) {
@@ -494,7 +508,7 @@ module.exports = function(crowi, app) {
         return res.render('admin/external-accounts', {
         return res.render('admin/external-accounts', {
           accounts: result.docs,
           accounts: result.docs,
           pager: pager
           pager: pager
-        })
+        });
       });
       });
   };
   };
 
 
@@ -515,13 +529,13 @@ module.exports = function(crowi, app) {
   };
   };
 
 
   actions.userGroup = {};
   actions.userGroup = {};
-  actions.userGroup.index = function (req, res) {
+  actions.userGroup.index = function(req, res) {
     var page = parseInt(req.query.page) || 1;
     var page = parseInt(req.query.page) || 1;
     var renderVar = {
     var renderVar = {
-      userGroups : [],
-      userGroupRelations : new Map(),
-      pager : null,
-    }
+      userGroups: [],
+      userGroupRelations: new Map(),
+      pager: null,
+    };
 
 
     UserGroup.findUserGroupsWithPagination({ page: page })
     UserGroup.findUserGroupsWithPagination({ page: page })
       .then((result) => {
       .then((result) => {
@@ -539,31 +553,31 @@ module.exports = function(crowi, app) {
         });
         });
       })
       })
       .then((allRelationsPromise) => {
       .then((allRelationsPromise) => {
-        return Promise.all(allRelationsPromise)
+        return Promise.all(allRelationsPromise);
       })
       })
       .then((relations) => {
       .then((relations) => {
         renderVar.userGroupRelations = new Map(relations);
         renderVar.userGroupRelations = new Map(relations);
-        debug("in findUserGroupsWithPagination findAllRelationForUserGroupResult", renderVar.userGroupRelations);
+        debug('in findUserGroupsWithPagination findAllRelationForUserGroupResult', renderVar.userGroupRelations);
         return res.render('admin/user-groups', renderVar);
         return res.render('admin/user-groups', renderVar);
       })
       })
       .catch( function(err) {
       .catch( function(err) {
-          debug('Error on find all relations', err);
-          return res.json(ApiResponse.error('Error'));
+        debug('Error on find all relations', err);
+        return res.json(ApiResponse.error('Error'));
       });
       });
   };
   };
 
 
   // グループ詳細
   // グループ詳細
-  actions.userGroup.detail = function (req, res) {
+  actions.userGroup.detail = function(req, res) {
     var name = req.params.name;
     var name = req.params.name;
     var renderVar = {
     var renderVar = {
       userGroup: null,
       userGroup: null,
       userGroupRelations: [],
       userGroupRelations: [],
       pageGroupRelations: [],
       pageGroupRelations: [],
       notRelatedusers: []
       notRelatedusers: []
-    }
+    };
     var targetUserGroup = null;
     var targetUserGroup = null;
     UserGroup.findUserGroupByName(name)
     UserGroup.findUserGroupByName(name)
-      .then(function (userGroup) {
+      .then(function(userGroup) {
         targetUserGroup = userGroup;
         targetUserGroup = userGroup;
         if (targetUserGroup == null) {
         if (targetUserGroup == null) {
           req.flash('errorMessage', 'グループがありません');
           req.flash('errorMessage', 'グループがありません');
@@ -595,15 +609,15 @@ module.exports = function(crowi, app) {
         debug('Error on get userGroupDetail', err);
         debug('Error on get userGroupDetail', err);
         return res.redirect('/admin/user-groups');
         return res.redirect('/admin/user-groups');
       });
       });
-  }
+  };
 
 
   //グループの生成
   //グループの生成
-  actions.userGroup.create = function (req, res) {
+  actions.userGroup.create = function(req, res) {
     var form = req.form.createGroupForm;
     var form = req.form.createGroupForm;
     if (req.form.isValid) {
     if (req.form.isValid) {
       UserGroup.createGroupByName(form.userGroupName)
       UserGroup.createGroupByName(form.userGroupName)
       .then((newUserGroup) => {
       .then((newUserGroup) => {
-        req.flash('successMessage', newUserGroup.name)
+        req.flash('successMessage', newUserGroup.name);
         req.flash('createdUserGroup', newUserGroup);
         req.flash('createdUserGroup', newUserGroup);
         return res.redirect('/admin/user-groups');
         return res.redirect('/admin/user-groups');
       })
       })
@@ -611,14 +625,15 @@ module.exports = function(crowi, app) {
         debug('create userGroup error:', err);
         debug('create userGroup error:', err);
         req.flash('errorMessage', '同じグループ名が既に存在します。');
         req.flash('errorMessage', '同じグループ名が既に存在します。');
       });
       });
-    } else {
+    }
+    else {
       req.flash('errorMessage', req.form.errors.join('\n'));
       req.flash('errorMessage', req.form.errors.join('\n'));
       return res.redirect('/admin/user-groups');
       return res.redirect('/admin/user-groups');
     }
     }
   };
   };
 
 
   //
   //
-  actions.userGroup.update = function (req, res) {
+  actions.userGroup.update = function(req, res) {
 
 
     var userGroupId = req.params.userGroupId;
     var userGroupId = req.params.userGroupId;
     var name = req.body.name;
     var name = req.body.name;
@@ -654,7 +669,7 @@ module.exports = function(crowi, app) {
     });
     });
   };
   };
 
 
-  actions.userGroup.uploadGroupPicture = function (req, res) {
+  actions.userGroup.uploadGroupPicture = function(req, res) {
     var fileUploader = require('../util/fileUploader')(crowi, app);
     var fileUploader = require('../util/fileUploader')(crowi, app);
     //var storagePlugin = new pluginService('storage');
     //var storagePlugin = new pluginService('storage');
     //var storage = require('../service/storage').StorageService(config);
     //var storage = require('../service/storage').StorageService(config);
@@ -669,7 +684,7 @@ module.exports = function(crowi, app) {
       });
       });
     }
     }
 
 
-    UserGroup.findById(userGroupId, function (err, userGroupData) {
+    UserGroup.findById(userGroupId, function(err, userGroupData) {
       if (!userGroupData) {
       if (!userGroupData) {
         return res.json({
         return res.json({
           'status': false,
           'status': false,
@@ -691,11 +706,11 @@ module.exports = function(crowi, app) {
       var tmpFileStream = fs.createReadStream(tmpPath, { flags: 'r', encoding: null, fd: null, mode: '0666', autoClose: true });
       var tmpFileStream = fs.createReadStream(tmpPath, { flags: 'r', encoding: null, fd: null, mode: '0666', autoClose: true });
 
 
       fileUploader.uploadFile(filePath, tmpFile.mimetype, tmpFileStream, {})
       fileUploader.uploadFile(filePath, tmpFile.mimetype, tmpFileStream, {})
-        .then(function (data) {
+        .then(function(data) {
           var imageUrl = fileUploader.generateUrl(filePath);
           var imageUrl = fileUploader.generateUrl(filePath);
           userGroupData.updateImage(imageUrl)
           userGroupData.updateImage(imageUrl)
           .then(() => {
           .then(() => {
-            fs.unlink(tmpPath, function (err) {
+            fs.unlink(tmpPath, function(err) {
               if (err) {
               if (err) {
                 debug('Error while deleting tmp file.', err);
                 debug('Error while deleting tmp file.', err);
               }
               }
@@ -707,7 +722,7 @@ module.exports = function(crowi, app) {
               });
               });
             });
             });
           });
           });
-        }).catch(function (err) {
+        }).catch(function(err) {
           debug('Uploading error', err);
           debug('Uploading error', err);
 
 
           return res.json({
           return res.json({
@@ -719,7 +734,7 @@ module.exports = function(crowi, app) {
 
 
   };
   };
 
 
-  actions.userGroup.deletePicture = function (req, res) {
+  actions.userGroup.deletePicture = function(req, res) {
 
 
     var userGroupId = req.params.userGroupId;
     var userGroupId = req.params.userGroupId;
     let userGroupName = null;
     let userGroupName = null;
@@ -753,12 +768,12 @@ module.exports = function(crowi, app) {
   };
   };
 
 
   // app.post('/_api/admin/user-group/delete' , admin.userGroup.removeCompletely);
   // app.post('/_api/admin/user-group/delete' , admin.userGroup.removeCompletely);
-  actions.userGroup.removeCompletely = function (req, res) {
+  actions.userGroup.removeCompletely = function(req, res) {
     const id = req.body.user_group_id;
     const id = req.body.user_group_id;
 
 
     UserGroup.removeCompletelyById(id)
     UserGroup.removeCompletelyById(id)
     .then(() => {
     .then(() => {
-        req.flash('successMessage', '削除しました');
+      req.flash('successMessage', '削除しました');
       return res.redirect('/admin/user-groups');
       return res.redirect('/admin/user-groups');
     })
     })
     .catch((err) => {
     .catch((err) => {
@@ -766,12 +781,12 @@ module.exports = function(crowi, app) {
       req.flash('errorMessage', '完全な削除に失敗しました。');
       req.flash('errorMessage', '完全な削除に失敗しました。');
       return res.redirect('/admin/user-groups');
       return res.redirect('/admin/user-groups');
     });
     });
-  }
+  };
 
 
   actions.userGroupRelation = {};
   actions.userGroupRelation = {};
   actions.userGroupRelation.index = function(req, res) {
   actions.userGroupRelation.index = function(req, res) {
 
 
-  }
+  };
 
 
   actions.userGroupRelation.create = function(req, res) {
   actions.userGroupRelation.create = function(req, res) {
     const User = crowi.model('User');
     const User = crowi.model('User');
@@ -795,18 +810,18 @@ module.exports = function(crowi, app) {
       userGroup = resolves[0];
       userGroup = resolves[0];
       user = resolves[1];
       user = resolves[1];
       // Relation を作成
       // Relation を作成
-      UserGroupRelation.createRelation(userGroup, user)
+      UserGroupRelation.createRelation(userGroup, user);
     })
     })
     .then((result) => {
     .then((result) => {
       return res.redirect('/admin/user-group-detail/' + userGroup.name);
       return res.redirect('/admin/user-group-detail/' + userGroup.name);
     }).catch((err) => {
     }).catch((err) => {
       debug('Error on create user-group relation', err);
       debug('Error on create user-group relation', err);
       req.flash('errorMessage', 'Error on create user-group relation');
       req.flash('errorMessage', 'Error on create user-group relation');
-          return res.redirect('/admin/user-group-detail/' + userGroup.name);
+      return res.redirect('/admin/user-group-detail/' + userGroup.name);
     });
     });
-  }
+  };
 
 
-  actions.userGroupRelation.remove = function (req, res) {
+  actions.userGroupRelation.remove = function(req, res) {
     const UserGroupRelation = crowi.model('UserGroupRelation');
     const UserGroupRelation = crowi.model('UserGroupRelation');
     var name = req.params.name;
     var name = req.params.name;
     var relationId = req.params.relationId;
     var relationId = req.params.relationId;
@@ -821,7 +836,7 @@ module.exports = function(crowi, app) {
       req.flash('errorMessage', 'グループのユーザ削除に失敗しました。');
       req.flash('errorMessage', 'グループのユーザ削除に失敗しました。');
     });
     });
 
 
-  }
+  };
 
 
   actions.api = {};
   actions.api = {};
   actions.api.appSetting = function(req, res) {
   actions.api.appSetting = function(req, res) {
@@ -841,10 +856,12 @@ module.exports = function(crowi, app) {
 
 
           return saveSetting(req, res, form);
           return saveSetting(req, res, form);
         });
         });
-      } else {
+      }
+      else {
         return saveSetting(req, res, form);
         return saveSetting(req, res, form);
       }
       }
-    } else {
+    }
+    else {
       return res.json({status: false, message: req.form.errors.join('\n')});
       return res.json({status: false, message: req.form.errors.join('\n')});
     }
     }
   };
   };
@@ -855,7 +872,8 @@ module.exports = function(crowi, app) {
     if (req.form.isValid) {
     if (req.form.isValid) {
       debug('form content', form);
       debug('form content', form);
       return saveSetting(req, res, form);
       return saveSetting(req, res, form);
-    } else {
+    }
+    else {
       return res.json({status: false, message: req.form.errors.join('\n')});
       return res.json({status: false, message: req.form.errors.join('\n')});
     }
     }
   };
   };
@@ -891,10 +909,11 @@ module.exports = function(crowi, app) {
     if (req.form.isValid) {
     if (req.form.isValid) {
       debug('form content', form);
       debug('form content', form);
       return saveSetting(req, res, form);
       return saveSetting(req, res, form);
-    } else {
+    }
+    else {
       return res.json({status: false, message: req.form.errors.join('\n')});
       return res.json({status: false, message: req.form.errors.join('\n')});
     }
     }
-  }
+  };
 
 
   // app.post('/_api/admin/notifications.add'    , admin.api.notificationAdd);
   // app.post('/_api/admin/notifications.add'    , admin.api.notificationAdd);
   actions.api.notificationAdd = function(req, res) {
   actions.api.notificationAdd = function(req, res) {
@@ -955,8 +974,7 @@ module.exports = function(crowi, app) {
    * @param {any} res
    * @param {any} res
    * @param {any} form
    * @param {any} form
    */
    */
-  function saveSetting(req, res, form)
-  {
+  function saveSetting(req, res, form) {
     Config.updateNamespaceByArray('crowi', form, function(err, config) {
     Config.updateNamespaceByArray('crowi', form, function(err, config) {
       Config.updateConfigCache('crowi', config);
       Config.updateConfigCache('crowi', config);
       return res.json({status: true});
       return res.json({status: true});
@@ -973,8 +991,8 @@ module.exports = function(crowi, app) {
     return new Promise((resolve, reject) => {
     return new Promise((resolve, reject) => {
       Config.updateNamespaceByArray('crowi', form, (err, config) => {
       Config.updateNamespaceByArray('crowi', form, (err, config) => {
         if (err) {
         if (err) {
-          return reject(err)
-        };
+          return reject(err);
+        }
 
 
         Config.updateConfigCache('crowi', config);
         Config.updateConfigCache('crowi', config);
         return resolve();
         return resolve();
@@ -982,8 +1000,7 @@ module.exports = function(crowi, app) {
     });
     });
   }
   }
 
 
-  function validateMailSetting(req, form, callback)
-  {
+  function validateMailSetting(req, form, callback) {
     var mailer = crowi.mailer;
     var mailer = crowi.mailer;
     var option = {
     var option = {
       host: form['mail:smtpHost'],
       host: form['mail:smtpHost'],

+ 9 - 8
lib/routes/attachment.js

@@ -54,7 +54,7 @@ module.exports = function(crowi, app) {
    *
    *
    * @apiParam {String} page_id
    * @apiParam {String} page_id
    */
    */
-  api.list = function(req, res){
+  api.list = function(req, res) {
     var id = req.query.page_id || null;
     var id = req.query.page_id || null;
     if (!id) {
     if (!id) {
       return res.json(ApiResponse.error('Parameters page_id is required.'));
       return res.json(ApiResponse.error('Parameters page_id is required.'));
@@ -90,7 +90,7 @@ module.exports = function(crowi, app) {
    * @apiParam {String} page_id
    * @apiParam {String} page_id
    * @apiParam {File} file
    * @apiParam {File} file
    */
    */
-  api.add = function(req, res){
+  api.add = function(req, res) {
     var id = req.body.page_id || 0,
     var id = req.body.page_id || 0,
       path = decodeURIComponent(req.body.path) || null,
       path = decodeURIComponent(req.body.path) || null,
       pageCreated = false,
       pageCreated = false,
@@ -116,7 +116,8 @@ module.exports = function(crowi, app) {
             resolve(page);
             resolve(page);
           })
           })
           .catch(reject);
           .catch(reject);
-      } else {
+      }
+      else {
         Page.findPageById(id).then(resolve).catch(reject);
         Page.findPageById(id).then(resolve).catch(reject);
       }
       }
     }).then(function(pageData) {
     }).then(function(pageData) {
@@ -152,20 +153,20 @@ module.exports = function(crowi, app) {
           result.attachment.creator = User.filterToPublicFields(result.attachment.creator);
           result.attachment.creator = User.filterToPublicFields(result.attachment.creator);
 
 
           // delete anyway
           // delete anyway
-          fs.unlink(tmpPath, function (err) { if (err) { debug('Error while deleting tmp file.'); } });
+          fs.unlink(tmpPath, function(err) { if (err) { debug('Error while deleting tmp file.') } });
 
 
           return res.json(ApiResponse.success(result));
           return res.json(ApiResponse.success(result));
-        }).catch(function (err) {
+        }).catch(function(err) {
           debug('Error on saving attachment data', err);
           debug('Error on saving attachment data', err);
           // @TODO
           // @TODO
           // Remove from S3
           // Remove from S3
 
 
           // delete anyway
           // delete anyway
-          fs.unlink(tmpPath, function (err) { if (err) { debug('Error while deleting tmp file.'); } });
+          fs.unlink(tmpPath, function(err) { if (err) { debug('Error while deleting tmp file.') } });
 
 
           return res.json(ApiResponse.error('Error while uploading.'));
           return res.json(ApiResponse.error('Error while uploading.'));
         });
         });
-      ;
+      
     }).catch(function(err) {
     }).catch(function(err) {
       debug('Attachement upload error', err);
       debug('Attachement upload error', err);
       return res.json(ApiResponse.error('Error.'));
       return res.json(ApiResponse.error('Error.'));
@@ -179,7 +180,7 @@ module.exports = function(crowi, app) {
    *
    *
    * @apiParam {String} attachment_id
    * @apiParam {String} attachment_id
    */
    */
-  api.remove = function(req, res){
+  api.remove = function(req, res) {
     const id = req.body.attachment_id;
     const id = req.body.attachment_id;
 
 
     Attachment.findById(id)
     Attachment.findById(id)

+ 4 - 3
lib/routes/bookmark.js

@@ -19,7 +19,7 @@ module.exports = function(crowi, app) {
    *
    *
    * @apiParam {String} page_id Page Id.
    * @apiParam {String} page_id Page Id.
    */
    */
-  actions.api.get = function (req, res) {
+  actions.api.get = function(req, res) {
     var pageId = req.query.page_id;
     var pageId = req.query.page_id;
 
 
     Bookmark.findByPageIdAndUserId(pageId, req.user)
     Bookmark.findByPageIdAndUserId(pageId, req.user)
@@ -50,7 +50,8 @@ module.exports = function(crowi, app) {
     .then(function(pageData) {
     .then(function(pageData) {
       if (pageData) {
       if (pageData) {
         return Bookmark.add(pageData, req.user);
         return Bookmark.add(pageData, req.user);
-      } else {
+      }
+      else {
         return res.json(ApiResponse.success({bookmark: null}));
         return res.json(ApiResponse.success({bookmark: null}));
       }
       }
     }).then(function(data) {
     }).then(function(data) {
@@ -72,7 +73,7 @@ module.exports = function(crowi, app) {
    *
    *
    * @apiParam {String} page_id Page Id.
    * @apiParam {String} page_id Page Id.
    */
    */
-  actions.api.remove = function(req, res){
+  actions.api.remove = function(req, res) {
     var pageId = req.body.page_id;
     var pageId = req.body.page_id;
 
 
     Bookmark.removeBookmark(pageId, req.user)
     Bookmark.removeBookmark(pageId, req.user)

+ 6 - 6
lib/routes/comment.js

@@ -19,7 +19,7 @@ module.exports = function(crowi, app) {
    * @apiParam {String} page_id Page Id.
    * @apiParam {String} page_id Page Id.
    * @apiParam {String} revision_id Revision Id.
    * @apiParam {String} revision_id Revision Id.
    */
    */
-  api.get = function(req, res){
+  api.get = function(req, res) {
     var pageId = req.query.page_id;
     var pageId = req.query.page_id;
     var revisionId = req.query.revision_id;
     var revisionId = req.query.revision_id;
 
 
@@ -50,7 +50,7 @@ module.exports = function(crowi, app) {
    * @apiParam {String} comment Comment body
    * @apiParam {String} comment Comment body
    * @apiParam {Number} comment_position=-1 Line number of the comment
    * @apiParam {Number} comment_position=-1 Line number of the comment
    */
    */
-  api.add = function(req, res){
+  api.add = function(req, res) {
     var form = req.form.commentForm;
     var form = req.form.commentForm;
 
 
     if (!req.form.isValid) {
     if (!req.form.isValid) {
@@ -79,20 +79,20 @@ module.exports = function(crowi, app) {
    *
    *
    * @apiParam {String} comment_id Comment Id.
    * @apiParam {String} comment_id Comment Id.
    */
    */
-  api.remove = function(req, res){
+  api.remove = function(req, res) {
     var commentId = req.body.comment_id;
     var commentId = req.body.comment_id;
     if (!commentId) {
     if (!commentId) {
-      return Promise.resolve(res.json(ApiResponse.error(`'comment_id' is undefined`)));
+      return Promise.resolve(res.json(ApiResponse.error('\'comment_id\' is undefined')));
     }
     }
 
 
     return Comment.findById(commentId).exec()
     return Comment.findById(commentId).exec()
       .then(function(comment) {
       .then(function(comment) {
         return comment.remove()
         return comment.remove()
         .then(function() {
         .then(function() {
-           return Page.updateCommentCount(comment.page);
+          return Page.updateCommentCount(comment.page);
         })
         })
         .then(function() {
         .then(function() {
-           return res.json(ApiResponse.success({})); 
+          return res.json(ApiResponse.success({})); 
         });
         });
       })
       })
       .catch(function(err) {
       .catch(function(err) {

+ 1 - 1
lib/routes/index.js

@@ -122,7 +122,7 @@ module.exports = function(crowi, app) {
 
 
   // user-group-relations admin
   // user-group-relations admin
   app.post('/admin/user-group-relation/create', loginRequired(crowi, app), middleware.adminRequired(), csrf, admin.userGroupRelation.create);
   app.post('/admin/user-group-relation/create', loginRequired(crowi, app), middleware.adminRequired(), csrf, admin.userGroupRelation.create);
-  app.post('/admin/user-group-relation/:name/remove-relation/:relationId', loginRequired(crowi, app), middleware.adminRequired(), csrf, admin.userGroupRelation.remove)
+  app.post('/admin/user-group-relation/:name/remove-relation/:relationId', loginRequired(crowi, app), middleware.adminRequired(), csrf, admin.userGroupRelation.remove);
 
 
   app.get('/me'                       , loginRequired(crowi, app) , me.index);
   app.get('/me'                       , loginRequired(crowi, app) , me.index);
   app.get('/me/password'              , loginRequired(crowi, app) , me.password);
   app.get('/me/password'              , loginRequired(crowi, app) , me.password);

+ 3 - 2
lib/routes/installer.js

@@ -58,7 +58,7 @@ module.exports = function(crowi, app) {
 
 
             // login with passport
             // login with passport
             req.logIn(userData, (err) => {
             req.logIn(userData, (err) => {
-              if (err) { return next(); }
+              if (err) { return next() }
               else {
               else {
                 req.flash('successMessage', 'GROWI のインストールが完了しました!はじめに、このページで各種設定を確認してください。');
                 req.flash('successMessage', 'GROWI のインストールが完了しました!はじめに、このページで各種設定を確認してください。');
                 return res.redirect('/admin/app');
                 return res.redirect('/admin/app');
@@ -70,7 +70,8 @@ module.exports = function(crowi, app) {
           createInitialPages(userData, language);
           createInitialPages(userData, language);
         });
         });
       });
       });
-    } else {
+    }
+    else {
       return res.render('installer');
       return res.render('installer');
     }
     }
   };
   };

+ 2 - 1
lib/routes/login-passport.js

@@ -27,7 +27,8 @@ module.exports = function(crowi, app) {
     if (jumpTo) {
     if (jumpTo) {
       req.session.jumpTo = null;
       req.session.jumpTo = null;
       return res.redirect(jumpTo);
       return res.redirect(jumpTo);
-    } else {
+    }
+    else {
       return res.redirect('/');
       return res.redirect('/');
     }
     }
   };
   };

+ 32 - 25
lib/routes/me.js

@@ -16,7 +16,7 @@ module.exports = function(crowi, app) {
 
 
   actions.api = api;
   actions.api = api;
 
 
-  api.uploadPicture = function (req, res) {
+  api.uploadPicture = function(req, res) {
     var fileUploader = require('../util/fileUploader')(crowi, app);
     var fileUploader = require('../util/fileUploader')(crowi, app);
     //var storagePlugin = new pluginService('storage');
     //var storagePlugin = new pluginService('storage');
     //var storage = require('../service/storage').StorageService(config);
     //var storage = require('../service/storage').StorageService(config);
@@ -53,7 +53,7 @@ module.exports = function(crowi, app) {
     .then(function(data) {
     .then(function(data) {
       var imageUrl = fileUploader.generateUrl(filePath);
       var imageUrl = fileUploader.generateUrl(filePath);
       req.user.updateImage(imageUrl, function(err, data) {
       req.user.updateImage(imageUrl, function(err, data) {
-        fs.unlink(tmpPath, function (err) {
+        fs.unlink(tmpPath, function(err) {
           // エラー自体は無視
           // エラー自体は無視
           if (err) {
           if (err) {
             debug('Error while deleting tmp file.', err);
             debug('Error while deleting tmp file.', err);
@@ -66,7 +66,7 @@ module.exports = function(crowi, app) {
           });
           });
         });
         });
       });
       });
-    }).catch(function (err) {
+    }).catch(function(err) {
       debug('Uploading error', err);
       debug('Uploading error', err);
 
 
       return res.json({
       return res.json({
@@ -99,7 +99,7 @@ module.exports = function(crowi, app) {
         { email: userData.email },                  // query
         { email: userData.email },                  // query
         { name, email, lang, isEmailPublished },                      // updating data
         { name, email, lang, isEmailPublished },                      // updating data
         { runValidators: true, context: 'query' },  // for validation
         { runValidators: true, context: 'query' },  // for validation
-                                                    //   see https://www.npmjs.com/package/mongoose-unique-validator#find--updates -- 2017.09.24 Yuki Takei
+        //   see https://www.npmjs.com/package/mongoose-unique-validator#find--updates -- 2017.09.24 Yuki Takei
         (err) => {
         (err) => {
           if (err) {
           if (err) {
             Object.keys(err.errors).forEach((e) => {
             Object.keys(err.errors).forEach((e) => {
@@ -112,7 +112,8 @@ module.exports = function(crowi, app) {
           return res.redirect('/me');
           return res.redirect('/me');
         });
         });
 
 
-    } else { // method GET
+    }
+    else { // method GET
       /*
       /*
        * disabled because the system no longer allows undefined email -- 2017.10.06 Yuki Takei
        * disabled because the system no longer allows undefined email -- 2017.10.06 Yuki Takei
        *
        *
@@ -127,7 +128,7 @@ module.exports = function(crowi, app) {
     }
     }
   };
   };
 
 
-  actions.imagetype = function(req,res) {
+  actions.imagetype = function(req, res) {
     if (req.method !== 'POST') {
     if (req.method !== 'POST') {
       // do nothing
       // do nothing
       return;
       return;
@@ -155,7 +156,7 @@ module.exports = function(crowi, app) {
       req.flash('successMessage', req.t('Updated'));
       req.flash('successMessage', req.t('Updated'));
       return res.redirect('/me');
       return res.redirect('/me');
     });
     });
-  }
+  };
 
 
   actions.externalAccounts = {};
   actions.externalAccounts = {};
   actions.externalAccounts.list = function(req, res) {
   actions.externalAccounts.list = function(req, res) {
@@ -176,7 +177,7 @@ module.exports = function(crowi, app) {
           return res.render('me/external-accounts', renderVars);
           return res.render('me/external-accounts', renderVars);
         }
         }
       });
       });
-  }
+  };
 
 
   actions.externalAccounts.disassociate = function(req, res) {
   actions.externalAccounts.disassociate = function(req, res) {
     const userData = req.user;
     const userData = req.user;
@@ -184,7 +185,7 @@ module.exports = function(crowi, app) {
     const redirectWithFlash = (type, msg) => {
     const redirectWithFlash = (type, msg) => {
       req.flash(type, msg);
       req.flash(type, msg);
       return res.redirect('/me/external-accounts');
       return res.redirect('/me/external-accounts');
-    }
+    };
 
 
     if (req.body == null) {
     if (req.body == null) {
       redirectWithFlash('errorMessage', 'Invalid form.');
       redirectWithFlash('errorMessage', 'Invalid form.');
@@ -198,7 +199,7 @@ module.exports = function(crowi, app) {
       else {
       else {
         ExternalAccount.count({user: userData})
         ExternalAccount.count({user: userData})
           .then((count) => {
           .then((count) => {
-            resolve(count > 1)
+            resolve(count > 1);
           });
           });
       }
       }
     })
     })
@@ -233,7 +234,7 @@ module.exports = function(crowi, app) {
       }
       }
     });
     });
 
 
-  }
+  };
 
 
   actions.externalAccounts.associateLdap = function(req, res) {
   actions.externalAccounts.associateLdap = function(req, res) {
     const passport = require('passport');
     const passport = require('passport');
@@ -242,7 +243,7 @@ module.exports = function(crowi, app) {
     const redirectWithFlash = (type, msg) => {
     const redirectWithFlash = (type, msg) => {
       req.flash(type, msg);
       req.flash(type, msg);
       return res.redirect('/me/external-accounts');
       return res.redirect('/me/external-accounts');
-    }
+    };
 
 
     if (!passportService.isLdapStrategySetup) {
     if (!passportService.isLdapStrategySetup) {
       debug('LdapStrategy has not been set up');
       debug('LdapStrategy has not been set up');
@@ -280,7 +281,7 @@ module.exports = function(crowi, app) {
     })(req, res, () => {});
     })(req, res, () => {});
 
 
 
 
-  }
+  };
 
 
   actions.password = function(req, res) {
   actions.password = function(req, res) {
     var passwordForm = req.body.mePassword;
     var passwordForm = req.body.mePassword;
@@ -310,7 +311,8 @@ module.exports = function(crowi, app) {
       // check password confirm
       // check password confirm
       if (newPassword != newPasswordConfirm) {
       if (newPassword != newPasswordConfirm) {
         req.form.errors.push('Failed to verify passwords');
         req.form.errors.push('Failed to verify passwords');
-      } else {
+      }
+      else {
         userData.updatePassword(newPassword, function(err, userData) {
         userData.updatePassword(newPassword, function(err, userData) {
           if (err) {
           if (err) {
             for (var e in err.errors) {
             for (var e in err.errors) {
@@ -325,7 +327,8 @@ module.exports = function(crowi, app) {
           return res.redirect('/me/password');
           return res.redirect('/me/password');
         });
         });
       }
       }
-    } else { // method GET
+    }
+    else { // method GET
       return res.render('me/password', {
       return res.render('me/password', {
       });
       });
     }
     }
@@ -338,16 +341,17 @@ module.exports = function(crowi, app) {
     if (req.method == 'POST' && req.form.isValid) {
     if (req.method == 'POST' && req.form.isValid) {
       userData.updateApiToken()
       userData.updateApiToken()
       .then(function(userData) {
       .then(function(userData) {
-          req.flash('successMessage', 'API Token updated');
-          return res.redirect('/me/apiToken');
+        req.flash('successMessage', 'API Token updated');
+        return res.redirect('/me/apiToken');
       })
       })
       .catch(function(err) {
       .catch(function(err) {
-          //req.flash('successMessage',);
-          req.form.errors.push('Failed to update API Token');
-          return res.render('me/api_token', {
-          });
+        //req.flash('successMessage',);
+        req.form.errors.push('Failed to update API Token');
+        return res.render('me/api_token', {
+        });
       });
       });
-    } else {
+    }
+    else {
       return res.render('me/api_token', {
       return res.render('me/api_token', {
       });
       });
     }
     }
@@ -379,7 +383,8 @@ module.exports = function(crowi, app) {
 
 
         return res.redirect('/me');
         return res.redirect('/me');
       });
       });
-    } else if (toConnect) {
+    }
+    else if (toConnect) {
       googleAuth.createAuthUrl(req, function(err, redirectUrl) {
       googleAuth.createAuthUrl(req, function(err, redirectUrl) {
         if (err) {
         if (err) {
           // TODO
           // TODO
@@ -388,7 +393,8 @@ module.exports = function(crowi, app) {
         req.session.googleCallbackAction = '/me/auth/google/callback';
         req.session.googleCallbackAction = '/me/auth/google/callback';
         return res.redirect(redirectUrl);
         return res.redirect(redirectUrl);
       });
       });
-    } else {
+    }
+    else {
       return res.redirect('/me');
       return res.redirect('/me');
     }
     }
   };
   };
@@ -414,7 +420,8 @@ module.exports = function(crowi, app) {
         if (!err && googleUser) {
         if (!err && googleUser) {
           req.flash('warningMessage.auth.google', 'This Google\'s account is connected by another user');
           req.flash('warningMessage.auth.google', 'This Google\'s account is connected by another user');
           return res.redirect('/me');
           return res.redirect('/me');
-        } else {
+        }
+        else {
           userData.updateGoogleId(googleId, function(err, userData) {
           userData.updateGoogleId(googleId, function(err, userData) {
             if (err) {
             if (err) {
               debug('Failed to updateGoogleId', err);
               debug('Failed to updateGoogleId', err);

+ 7 - 4
lib/routes/revision.js

@@ -24,7 +24,7 @@ module.exports = function(crowi, app) {
       .then(function(revisionData) {
       .then(function(revisionData) {
         var result = {
         var result = {
           revision: revisionData,
           revision: revisionData,
-        }
+        };
         return res.json(ApiResponse.success(result));
         return res.json(ApiResponse.success(result));
       })
       })
       .catch(function(err) {
       .catch(function(err) {
@@ -53,7 +53,8 @@ module.exports = function(crowi, app) {
       }).catch(function(err) {
       }).catch(function(err) {
         return res.json(ApiResponse.error(err));
         return res.json(ApiResponse.error(err));
       });
       });
-    } else {
+    }
+    else {
       return res.json(ApiResponse.error('Parameter error.'));
       return res.json(ApiResponse.error('Parameter error.'));
     }
     }
   };
   };
@@ -80,14 +81,16 @@ module.exports = function(crowi, app) {
       }).catch(function(err) {
       }).catch(function(err) {
         return res.json(ApiResponse.error(err));
         return res.json(ApiResponse.error(err));
       });
       });
-    } else if (revisionIds.length > 0) {
+    }
+    else if (revisionIds.length > 0) {
       Revision.findRevisions(revisionIds)
       Revision.findRevisions(revisionIds)
       .then(function(revisions) {
       .then(function(revisions) {
         return res.json(ApiResponse.success(revisions));
         return res.json(ApiResponse.success(revisions));
       }).catch(function(err) {
       }).catch(function(err) {
         return res.json(ApiResponse.error(err));
         return res.json(ApiResponse.error(err));
       });
       });
-    } else {
+    }
+    else {
       return res.json(ApiResponse.error('Parameter error.'));
       return res.json(ApiResponse.error('Parameter error.'));
     }
     }
   };
   };

+ 3 - 2
lib/routes/search.js

@@ -29,7 +29,7 @@ module.exports = function(crowi, app) {
    * @apiParam {String} q keyword
    * @apiParam {String} q keyword
    * @apiParam {String} path
    * @apiParam {String} path
    */
    */
-  api.search = function(req, res){
+  api.search = function(req, res) {
     var keyword = req.query.q || null;
     var keyword = req.query.q || null;
     var tree = req.query.tree || null;
     var tree = req.query.tree || null;
     if (keyword === null || keyword === '') {
     if (keyword === null || keyword === '') {
@@ -45,7 +45,8 @@ module.exports = function(crowi, app) {
     var doSearch;
     var doSearch;
     if (tree) {
     if (tree) {
       doSearch = search.searchKeywordUnderPath(keyword, tree, {});
       doSearch = search.searchKeywordUnderPath(keyword, tree, {});
-    } else {
+    }
+    else {
       doSearch = search.searchKeyword(keyword, {});
       doSearch = search.searchKeyword(keyword, {});
     }
     }
     var result = {};
     var result = {};

+ 8 - 6
lib/routes/user.js

@@ -1,7 +1,7 @@
 module.exports = function(crowi, app) {
 module.exports = function(crowi, app) {
   'use strict';
   'use strict';
 
 
-   var Page = crowi.model('Page')
+  var Page = crowi.model('Page')
     , User = crowi.model('User')
     , User = crowi.model('User')
     , Revision = crowi.model('Revision')
     , Revision = crowi.model('Revision')
     , Bookmark = crowi.model('Bookmark')
     , Bookmark = crowi.model('Bookmark')
@@ -16,7 +16,7 @@ module.exports = function(crowi, app) {
       skip: req.query.offset || 0,
       skip: req.query.offset || 0,
       limit: req.query.limit || 50,
       limit: req.query.limit || 50,
     };
     };
-    Bookmark.findByUser(req.user, options, function (err, bookmarks) {
+    Bookmark.findByUser(req.user, options, function(err, bookmarks) {
       res.json(bookmarks);
       res.json(bookmarks);
     });
     });
   };
   };
@@ -28,7 +28,8 @@ module.exports = function(crowi, app) {
     .then(function(userData) {
     .then(function(userData) {
       if (userData) {
       if (userData) {
         return res.json({ valid: false });
         return res.json({ valid: false });
-      } else {
+      }
+      else {
         return res.json({ valid: true });
         return res.json({ valid: true });
       }
       }
     }).catch(function(err) {
     }).catch(function(err) {
@@ -48,9 +49,10 @@ module.exports = function(crowi, app) {
 
 
     var userFetcher;
     var userFetcher;
     if (!userIds || userIds.split(',').length <= 0) {
     if (!userIds || userIds.split(',').length <= 0) {
-      userFetcher = User.findAllUsers()
-    } else {
-      userFetcher = User.findUsersByIds(userIds.split(','))
+      userFetcher = User.findAllUsers();
+    }
+    else {
+      userFetcher = User.findUsersByIds(userIds.split(','));
     }
     }
 
 
     userFetcher
     userFetcher

+ 4 - 8
lib/service/notification.js

@@ -1,13 +1,11 @@
 'use strict';
 'use strict';
 
 
-function Notification (crowi)
-{
+function Notification(crowi) {
   this.crowi = crowi;
   this.crowi = crowi;
   this.config = crowi.getConfig();
   this.config = crowi.getConfig();
 }
 }
 
 
-Notification.prototype.hasSlackConfig = function()
-{
+Notification.prototype.hasSlackConfig = function() {
   if (!this.config.notification['slack']) {
   if (!this.config.notification['slack']) {
     return false;
     return false;
   }
   }
@@ -15,12 +13,10 @@ Notification.prototype.hasSlackConfig = function()
   //var config = ;
   //var config = ;
 };
 };
 
 
-Notification.prototype.noitfyByEmail = function()
-{
+Notification.prototype.noitfyByEmail = function() {
 };
 };
 
 
-Notification.prototype.noitfyByChat = function()
-{
+Notification.prototype.noitfyByChat = function() {
 };
 };
 
 
 module.exports = Notification;
 module.exports = Notification;

+ 4 - 4
lib/service/passport.js

@@ -65,7 +65,7 @@ class PassportService {
       (username, password, done) => {
       (username, password, done) => {
         // find user
         // find user
         User.findUserByUsernameOrEmail(username, password, (err, user) => {
         User.findUserByUsernameOrEmail(username, password, (err, user) => {
-          if (err) { return done(err); }
+          if (err) { return done(err) }
           // check existence and password
           // check existence and password
           if (!user || !user.isPasswordValid(password)) {
           if (!user || !user.isPasswordValid(password)) {
             return done(null, false, { message: 'Incorrect credentials.' });
             return done(null, false, { message: 'Incorrect credentials.' });
@@ -114,7 +114,7 @@ class PassportService {
 
 
     passport.use(new LdapStrategy(this.getLdapConfigurationFunc(config, {passReqToCallback: true}),
     passport.use(new LdapStrategy(this.getLdapConfigurationFunc(config, {passReqToCallback: true}),
       (req, ldapAccountInfo, done) => {
       (req, ldapAccountInfo, done) => {
-        debug("LDAP authentication has succeeded", ldapAccountInfo);
+        debug('LDAP authentication has succeeded', ldapAccountInfo);
         done(null, ldapAccountInfo);
         done(null, ldapAccountInfo);
       }
       }
     ));
     ));
@@ -196,8 +196,8 @@ class PassportService {
 
 
       // user bind
       // user bind
       const fixedBindDN = (isUserBind) ?
       const fixedBindDN = (isUserBind) ?
-          bindDN.replace(/{{username}}/, loginForm.username):
-          bindDN;
+        bindDN.replace(/{{username}}/, loginForm.username):
+        bindDN;
       const fixedBindCredentials = (isUserBind) ? loginForm.password : bindCredentials;
       const fixedBindCredentials = (isUserBind) ? loginForm.password : bindCredentials;
       let serverOpt = { url, bindDN: fixedBindDN, bindCredentials: fixedBindCredentials, searchBase, searchFilter };
       let serverOpt = { url, bindDN: fixedBindDN, bindCredentials: fixedBindCredentials, searchBase, searchFilter };
 
 

+ 6 - 5
lib/util/apiResponse.js

@@ -1,9 +1,9 @@
 'use strict';
 'use strict';
 
 
-function ApiResponse () {
-};
+function ApiResponse() {
+}
 
 
-ApiResponse.error = function (err) {
+ApiResponse.error = function(err) {
   var result = {};
   var result = {};
 
 
   result = {
   result = {
@@ -12,14 +12,15 @@ ApiResponse.error = function (err) {
 
 
   if (err instanceof Error) {
   if (err instanceof Error) {
     result.error = err.toString();
     result.error = err.toString();
-  } else {
+  }
+  else {
     result.error = err;
     result.error = err;
   }
   }
 
 
   return result;
   return result;
 };
 };
 
 
-ApiResponse.success = function (data) {
+ApiResponse.success = function(data) {
   var result = data || {};
   var result = data || {};
 
 
   result.ok = true;
   result.ok = true;

+ 11 - 10
lib/util/mailer.js

@@ -16,8 +16,7 @@ module.exports = function(crowi) {
     ;
     ;
 
 
 
 
-  function createSMTPClient(option)
-  {
+  function createSMTPClient(option) {
     var client;
     var client;
 
 
     debug('createSMTPClient option', option);
     debug('createSMTPClient option', option);
@@ -45,8 +44,7 @@ module.exports = function(crowi) {
     return client;
     return client;
   }
   }
 
 
-  function createSESClient(option)
-  {
+  function createSESClient(option) {
     var client;
     var client;
 
 
     if (!option) {
     if (!option) {
@@ -70,14 +68,16 @@ module.exports = function(crowi) {
     }
     }
 
 
     if (config.crowi['mail:smtpHost'] && config.crowi['mail:smtpPort']
     if (config.crowi['mail:smtpHost'] && config.crowi['mail:smtpPort']
-      ) {
+    ) {
       // SMTP 設定がある場合はそれを優先
       // SMTP 設定がある場合はそれを優先
       mailer = createSMTPClient();
       mailer = createSMTPClient();
 
 
-    } else if (config.crowi['aws:accessKeyId'] && config.crowi['aws:secretAccessKey']) {
+    }
+    else if (config.crowi['aws:accessKeyId'] && config.crowi['aws:secretAccessKey']) {
       // AWS 設定がある場合はSESを設定
       // AWS 設定がある場合はSESを設定
       mailer = createSESClient();
       mailer = createSESClient();
-    } else {
+    }
+    else {
       mailer = undefined;
       mailer = undefined;
     }
     }
 
 
@@ -87,7 +87,7 @@ module.exports = function(crowi) {
     debug('mailer initialized');
     debug('mailer initialized');
   }
   }
 
 
-  function setupMailConfig (overrideConfig) {
+  function setupMailConfig(overrideConfig) {
     var c = overrideConfig
     var c = overrideConfig
       , mc = {}
       , mc = {}
       ;
       ;
@@ -107,7 +107,7 @@ module.exports = function(crowi) {
       return swig.renderFile(
       return swig.renderFile(
         MAIL_TEMPLATE_DIR + config.template,
         MAIL_TEMPLATE_DIR + config.template,
         templateVars,
         templateVars,
-        function (err, output) {
+        function(err, output) {
           if (err) {
           if (err) {
             throw err;
             throw err;
           }
           }
@@ -116,7 +116,8 @@ module.exports = function(crowi) {
           return mailer.sendMail(setupMailConfig(config), callback);
           return mailer.sendMail(setupMailConfig(config), callback);
         }
         }
       );
       );
-    } else {
+    }
+    else {
       debug('Mailer is not completed to set up. Please set up SMTP or AWS setting.');
       debug('Mailer is not completed to set up. Please set up SMTP or AWS setting.');
       return callback(new Error('Mailer is not completed to set up. Please set up SMTP or AWS setting.'), null);
       return callback(new Error('Mailer is not completed to set up. Please set up SMTP or AWS setting.'), null);
     }
     }

+ 16 - 11
lib/util/middlewares.js

@@ -10,8 +10,8 @@ exports.csrfKeyGenerator = function(crowi, app) {
     }
     }
 
 
     next();
     next();
-  }
-}
+  };
+};
 
 
 exports.loginChecker = function(crowi, app) {
 exports.loginChecker = function(crowi, app) {
   return function(req, res, next) {
   return function(req, res, next) {
@@ -22,13 +22,15 @@ exports.loginChecker = function(crowi, app) {
       User.findById(req.session.user._id, function(err, userData) {
       User.findById(req.session.user._id, function(err, userData) {
         if (err) {
         if (err) {
           next();
           next();
-        } else {
+        }
+        else {
           req.user = req.session.user = userData;
           req.user = req.session.user = userData;
           res.locals.user = req.user;
           res.locals.user = req.user;
           next();
           next();
         }
         }
       });
       });
-    } else {
+    }
+    else {
       req.user = req.session.user = false;
       req.user = req.session.user = false;
       res.locals.user = req.user;
       res.locals.user = req.user;
       next();
       next();
@@ -204,7 +206,7 @@ exports.adminRequired = function() {
  */
  */
 exports.loginRequired = function(crowi, app, isStrictly = true) {
 exports.loginRequired = function(crowi, app, isStrictly = true) {
   return function(req, res, next) {
   return function(req, res, next) {
-    var User = crowi.model('User')
+    var User = crowi.model('User');
 
 
     // when the route is not strictly restricted
     // when the route is not strictly restricted
     if (!isStrictly) {
     if (!isStrictly) {
@@ -223,11 +225,14 @@ exports.loginRequired = function(crowi, app, isStrictly = true) {
       if (req.user.status === User.STATUS_ACTIVE) {
       if (req.user.status === User.STATUS_ACTIVE) {
         // Active の人だけ先に進める
         // Active の人だけ先に進める
         return next();
         return next();
-      } else if (req.user.status === User.STATUS_REGISTERED) {
+      }
+      else if (req.user.status === User.STATUS_REGISTERED) {
         return res.redirect('/login/error/registered');
         return res.redirect('/login/error/registered');
-      } else if (req.user.status === User.STATUS_SUSPENDED) {
+      }
+      else if (req.user.status === User.STATUS_SUSPENDED) {
         return res.redirect('/login/error/suspended');
         return res.redirect('/login/error/suspended');
-      } else if (req.user.status === User.STATUS_INVITED) {
+      }
+      else if (req.user.status === User.STATUS_INVITED) {
         return res.redirect('/login/invited');
         return res.redirect('/login/invited');
       }
       }
     }
     }
@@ -251,7 +256,7 @@ exports.accessTokenParser = function(crowi, app) {
       return next();
       return next();
     }
     }
 
 
-    var User = crowi.model('User')
+    var User = crowi.model('User');
 
 
     debug('accessToken is', accessToken);
     debug('accessToken is', accessToken);
     User.findUserByApiToken(accessToken)
     User.findUserByApiToken(accessToken)
@@ -306,7 +311,7 @@ exports.checkSearchIndicesGenerated = function(crowi, app) {
 
 
     return next();
     return next();
   };
   };
-}
+};
 
 
 exports.applicationInstalled = function() {
 exports.applicationInstalled = function() {
   return function(req, res, next) {
   return function(req, res, next) {
@@ -321,7 +326,7 @@ exports.applicationInstalled = function() {
 };
 };
 
 
 exports.awsEnabled = function() {
 exports.awsEnabled = function() {
-  return function (req, res, next) {
+  return function(req, res, next) {
     var config = req.config;
     var config = req.config;
     if (config.crowi['aws:region'] !== '' && config.crowi['aws:bucket'] !== '' && config.crowi['aws:accessKeyId'] !== '' && config.crowi['aws:secretAccessKey'] !== '') {
     if (config.crowi['aws:region'] !== '' && config.crowi['aws:bucket'] !== '' && config.crowi['aws:accessKeyId'] !== '' && config.crowi['aws:secretAccessKey'] !== '') {
       req.flash('globalError', 'AWS settings required to use this function. Please ask the administrator.');
       req.flash('globalError', 'AWS settings required to use this function. Please ask the administrator.');

+ 1 - 1
lib/util/xss.js

@@ -13,7 +13,7 @@ class Xss {
       // allow all attributes
       // allow all attributes
       option.onTagAttr = function(tag, name, value, isWhiteAttr) {
       option.onTagAttr = function(tag, name, value, isWhiteAttr) {
         return `${name}="${value}"`;
         return `${name}="${value}"`;
-      }
+      };
     }
     }
     // create the XSS Filter instance
     // create the XSS Filter instance
     this.myxss = new xss.FilterXSS(option);
     this.myxss = new xss.FilterXSS(option);

+ 1 - 1
local_modules/crowi-fileupload-local/index.js

@@ -54,7 +54,7 @@ module.exports = function(crowi) {
     return path.posix.join('/uploads', filePath);
     return path.posix.join('/uploads', filePath);
   };
   };
 
 
-  lib.findDeliveryFile = function (fileId, filePath) {
+  lib.findDeliveryFile = function(fileId, filePath) {
     return Promise.resolve(lib.generateUrl(filePath));
     return Promise.resolve(lib.generateUrl(filePath));
   };
   };
 
 

+ 2 - 1
resource/js/components/BookmarkButton.js

@@ -38,7 +38,8 @@ export default class BookmarkButton extends React.Component {
       .then(res => {
       .then(res => {
         this.markBookmarked();
         this.markBookmarked();
       });
       });
-    } else {
+    }
+    else {
       this.props.crowi.apiPost('/bookmarks.remove', {page_id: pageId})
       this.props.crowi.apiPost('/bookmarks.remove', {page_id: pageId})
       .then(res => {
       .then(res => {
         this.markUnBookmarked();
         this.markUnBookmarked();

+ 2 - 2
resource/js/components/CopyButton.js

@@ -21,9 +21,9 @@ export default class CopyButton extends React.Component {
   render() {
   render() {
     const containerStyle = {
     const containerStyle = {
       lineHeight: 0
       lineHeight: 0
-    }
+    };
     const style = Object.assign({
     const style = Object.assign({
-      padding: "0 2px",
+      padding: '0 2px',
       verticalAlign: 'text-top',
       verticalAlign: 'text-top',
     }, this.props.buttonStyle);
     }, this.props.buttonStyle);
 
 

+ 2 - 2
resource/js/components/Page/RevisionBody.js

@@ -35,7 +35,7 @@ export default class RevisionBody extends React.Component {
 
 
   renderMathJax() {
   renderMathJax() {
     const MathJax = window.MathJax;
     const MathJax = window.MathJax;
-    MathJax.Hub.Queue(["Typeset", MathJax.Hub, this.element]);
+    MathJax.Hub.Queue(['Typeset', MathJax.Hub, this.element]);
   }
   }
 
 
   generateInnerHtml(html) {
   generateInnerHtml(html) {
@@ -53,7 +53,7 @@ export default class RevisionBody extends React.Component {
         }}
         }}
         className="wiki" dangerouslySetInnerHTML={this.generateInnerHtml(this.props.html)}>
         className="wiki" dangerouslySetInnerHTML={this.generateInnerHtml(this.props.html)}>
       </div>
       </div>
-    )
+    );
   }
   }
 }
 }
 
 

+ 1 - 1
resource/js/components/Page/RevisionUrl.js

@@ -8,7 +8,7 @@ export default class RevisionUrl extends React.Component {
   render() {
   render() {
     const buttonStyle = {
     const buttonStyle = {
       fontSize: '1em'
       fontSize: '1em'
-    }
+    };
 
 
     const url = (this.props.pageId == null)
     const url = (this.props.pageId == null)
       ? decodeURIComponent(location.href)
       ? decodeURIComponent(location.href)

+ 1 - 1
resource/js/components/PageAttachment/DeleteAttachmentModal.js

@@ -57,7 +57,7 @@ export default class DeleteAttachmentModal extends React.Component {
 
 
     let deletingIndicator = '';
     let deletingIndicator = '';
     if (this.props.deleting) {
     if (this.props.deleting) {
-      deletingIndicator = <div class="speeding-wheel-sm"></div>;
+      deletingIndicator = <div className="speeding-wheel-sm"></div>;
     }
     }
     if (this.props.deleteError) {
     if (this.props.deleteError) {
       deletingIndicator = <span>{this.props.deleteError}</span>;
       deletingIndicator = <span>{this.props.deleteError}</span>;

+ 1 - 1
resource/js/components/PageAttachment/PageAttachmentList.js

@@ -12,7 +12,7 @@ export default class PageAttachmentList extends React.Component {
     const attachmentList = this.props.attachments.map((attachment, idx) => {
     const attachmentList = this.props.attachments.map((attachment, idx) => {
       return (
       return (
         <Attachment
         <Attachment
-          key={"page:attachment:" + attachment._id}
+          key={'page:attachment:' + attachment._id}
           attachment={attachment}
           attachment={attachment}
           inUse={this.props.inUse[attachment._id] || false}
           inUse={this.props.inUse[attachment._id] || false}
           onAttachmentDeleteClicked={this.props.onAttachmentDeleteClicked}
           onAttachmentDeleteClicked={this.props.onAttachmentDeleteClicked}

+ 1 - 1
resource/js/components/PageComment/Comment.js

@@ -35,7 +35,7 @@ export default class Comment extends React.Component {
   }
   }
 
 
   getRootClassName() {
   getRootClassName() {
-    return "page-comment "
+    return 'page-comment '
         + (this.isCurrentUserEqualsToAuthor() ? 'page-comment-me ' : '');
         + (this.isCurrentUserEqualsToAuthor() ? 'page-comment-me ' : '');
   }
   }
 
 

+ 2 - 2
resource/js/components/PageComment/DeleteCommentModal.js

@@ -14,7 +14,7 @@ export default class DeleteCommentModal extends React.Component {
   /*
   /*
    * the threshold for omitting body
    * the threshold for omitting body
    */
    */
-  static get OMIT_BODY_THRES() { return 400 };
+  static get OMIT_BODY_THRES() { return 400 }
 
 
   constructor(props) {
   constructor(props) {
     super(props);
     super(props);
@@ -25,7 +25,7 @@ export default class DeleteCommentModal extends React.Component {
 
 
   render() {
   render() {
     if (this.props.comment === undefined) {
     if (this.props.comment === undefined) {
-      return <div></div>
+      return <div></div>;
     }
     }
 
 
     const comment = this.props.comment;
     const comment = this.props.comment;

+ 3 - 2
resource/js/components/PageCommentFormBehavior.js

@@ -39,7 +39,8 @@ export default class PageCommentFormBehavior extends React.Component {
 
 
           $('#comment-form-comment').val('');
           $('#comment-form-comment').val('');
           $('#comment-form-message').text('');
           $('#comment-form-message').text('');
-        } else {
+        }
+        else {
           $('#comment-form-message').text(data.error);
           $('#comment-form-message').text(data.error);
         }
         }
       }).fail(function(data) {
       }).fail(function(data) {
@@ -54,7 +55,7 @@ export default class PageCommentFormBehavior extends React.Component {
 
 
   render() {
   render() {
     // render nothing
     // render nothing
-    return <div></div>
+    return <div></div>;
   }
   }
 }
 }
 
 

+ 2 - 2
resource/js/components/PageEditor/MarkdownListUtil.js

@@ -64,7 +64,7 @@ class MarkdownListUtil {
       // indent
       // indent
       const replacedLines = lines.map((line) => {
       const replacedLines = lines.map((line) => {
         return indent + line;
         return indent + line;
-      })
+      });
 
 
       adjusted = replacedLines.join('\n');
       adjusted = replacedLines.join('\n');
     }
     }
@@ -75,7 +75,7 @@ class MarkdownListUtil {
     // not listful data
     // not listful data
     else {
     else {
       // append `indentAndMark` at the beginning of all lines (except the first line)
       // append `indentAndMark` at the beginning of all lines (except the first line)
-      const replacedText = text.replace(/(\r\n|\r|\n)/g, "$1" + indentAndMark);
+      const replacedText = text.replace(/(\r\n|\r|\n)/g, '$1' + indentAndMark);
       // append `indentAndMark` to the first line
       // append `indentAndMark` to the first line
       adjusted = indentAndMark + replacedText;
       adjusted = indentAndMark + replacedText;
     }
     }

+ 5 - 4
resource/js/components/PageEditor/MarkdownTableUtil.js

@@ -111,16 +111,17 @@ class MarkdownTableUtil {
           { align: 'l', regex: /^:-+$/  },
           { align: 'l', regex: /^:-+$/  },
           { align: 'r', regex: /^-+:$/  },
           { align: 'r', regex: /^-+:$/  },
         ];
         ];
-        let lineText = "";
+        let lineText = '';
         lineText = line.replace(/^\||\|$/g, ''); // strip off pipe charactor which is placed head of line and last of line.
         lineText = line.replace(/^\||\|$/g, ''); // strip off pipe charactor which is placed head of line and last of line.
         lineText = lineText.replace(/\s*/g, '');
         lineText = lineText.replace(/\s*/g, '');
         aligns = lineText.split(/\|/).map(col => {
         aligns = lineText.split(/\|/).map(col => {
           const rule = alignRuleRE.find(rule => col.match(rule.regex));
           const rule = alignRuleRE.find(rule => col.match(rule.regex));
           return (rule != undefined) ? rule.align : '';
           return (rule != undefined) ? rule.align : '';
         });
         });
-      } else if (this.linePartOfTableRE.test(line)) {
+      }
+      else if (this.linePartOfTableRE.test(line)) {
         // parse line whether header or body
         // parse line whether header or body
-        let lineText = "";
+        let lineText = '';
         lineText = line.replace(/\s*\|\s*/g, '|');
         lineText = line.replace(/\s*\|\s*/g, '|');
         lineText = lineText.replace(/^\||\|$/g, ''); // strip off pipe charactor which is placed head of line and last of line.
         lineText = lineText.replace(/^\||\|$/g, ''); // strip off pipe charactor which is placed head of line and last of line.
         const row = lineText.split(/\|/);
         const row = lineText.split(/\|/);
@@ -164,7 +165,7 @@ class MarkdownTableUtil {
     let newTable = [];
     let newTable = [];
     const options = mdtable_list[0].options; // use option of first markdown-table
     const options = mdtable_list[0].options; // use option of first markdown-table
     mdtable_list.forEach((mdtable) => {
     mdtable_list.forEach((mdtable) => {
-      newTable = newTable.concat(mdtable.table)
+      newTable = newTable.concat(mdtable.table);
     });
     });
     return (new MarkdownTable(newTable, options));
     return (new MarkdownTable(newTable, options));
   }
   }

+ 1 - 1
resource/js/components/PageEditor/Preview.js

@@ -34,7 +34,7 @@ export default class Preview extends React.Component {
           renderMathJaxInRealtime={renderMathJaxInRealtime}
           renderMathJaxInRealtime={renderMathJaxInRealtime}
         />
         />
       </div>
       </div>
-    )
+    );
   }
   }
 }
 }
 
 

+ 3 - 2
resource/js/components/PageEditor/ScrollSyncHelper.js

@@ -19,7 +19,7 @@ class ScrollSyncHelper {
         parentElement.getElementsByClassName('code-line'),
         parentElement.getElementsByClassName('code-line'),
         element => {
         element => {
           const line = +element.getAttribute('data-line');
           const line = +element.getAttribute('data-line');
-          return { element, line }
+          return { element, line };
         })
         })
         .filter(x => !isNaN(x.line));
         .filter(x => !isNaN(x.line));
     }
     }
@@ -101,7 +101,8 @@ class ScrollSyncHelper {
       if (next) {
       if (next) {
         const betweenProgress = (offset - parentElement.scrollTop - previous.element.getBoundingClientRect().top) / (next.element.getBoundingClientRect().top - previous.element.getBoundingClientRect().top);
         const betweenProgress = (offset - parentElement.scrollTop - previous.element.getBoundingClientRect().top) / (next.element.getBoundingClientRect().top - previous.element.getBoundingClientRect().top);
         return previous.line + betweenProgress * (next.line - previous.line);
         return previous.line + betweenProgress * (next.line - previous.line);
-      } else {
+      }
+      else {
         return previous.line;
         return previous.line;
       }
       }
     }
     }

+ 3 - 2
resource/js/components/PageHistory.js

@@ -38,7 +38,8 @@ export default class PageHistory extends React.Component {
 
 
         if (i === 0 || i === lastId) {
         if (i === 0 || i === lastId) {
           diffOpened[revision._id] = true;
           diffOpened[revision._id] = true;
-        } else {
+        }
+        else {
           diffOpened[revision._id] = false;
           diffOpened[revision._id] = false;
         }
         }
       });
       });
@@ -106,7 +107,7 @@ export default class PageHistory extends React.Component {
 
 
             return rev;
             return rev;
           })
           })
-        })
+        });
       }
       }
     }).catch(err => {
     }).catch(err => {
 
 

+ 7 - 6
resource/js/components/PageHistory/PageRevisionList.js

@@ -12,29 +12,30 @@ export default class PageRevisionList extends React.Component {
 
 
     const revisionList = this.props.revisions.map((revision, idx) => {
     const revisionList = this.props.revisions.map((revision, idx) => {
       const revisionId = revision._id
       const revisionId = revision._id
-        , revisionDiffOpened = this.props.diffOpened[revisionId] || false
+        , revisionDiffOpened = this.props.diffOpened[revisionId] || false;
 
 
 
 
       let previousRevision;
       let previousRevision;
       if (idx+1 < revisionCount) {
       if (idx+1 < revisionCount) {
         previousRevision = revisions[idx + 1];
         previousRevision = revisions[idx + 1];
-      } else {
+      }
+      else {
         previousRevision = revision; // if it is the first revision, show full text as diff text
         previousRevision = revision; // if it is the first revision, show full text as diff text
       }
       }
 
 
       return (
       return (
-        <div className="revision-hisory-outer" key={"revision-history-" + revisionId}>
+        <div className="revision-hisory-outer" key={'revision-history-' + revisionId}>
           <Revision
           <Revision
             revision={revision}
             revision={revision}
             revisionDiffOpened={revisionDiffOpened}
             revisionDiffOpened={revisionDiffOpened}
             onDiffOpenClicked={this.props.onDiffOpenClicked}
             onDiffOpenClicked={this.props.onDiffOpenClicked}
-            key={"revision-history-rev-" + revisionId}
+            key={'revision-history-rev-' + revisionId}
             />
             />
           <RevisionDiff
           <RevisionDiff
             revisionDiffOpened={revisionDiffOpened}
             revisionDiffOpened={revisionDiffOpened}
             currentRevision={revision}
             currentRevision={revision}
             previousRevision={previousRevision}
             previousRevision={previousRevision}
-            key={"revision-diff-" + revisionId}
+            key={'revision-diff-' + revisionId}
           />
           />
         </div>
         </div>
       );
       );
@@ -52,5 +53,5 @@ PageRevisionList.propTypes = {
   revisions: PropTypes.array,
   revisions: PropTypes.array,
   diffOpened: PropTypes.object,
   diffOpened: PropTypes.object,
   onDiffOpenClicked: PropTypes.func.isRequired,
   onDiffOpenClicked: PropTypes.func.isRequired,
-}
+};
 
 

+ 2 - 2
resource/js/components/PageHistory/Revision.js

@@ -46,7 +46,7 @@ export default class Revision extends React.Component {
               <a className="diff-view" onClick={this._onDiffOpenClicked}>
               <a className="diff-view" onClick={this._onDiffOpenClicked}>
                 <i className={iconClass}></i> View diff
                 <i className={iconClass}></i> View diff
               </a>
               </a>
-              <a href={"?revision=" + revision._id } className="m-l-10">
+              <a href={'?revision=' + revision._id } className="m-l-10">
                 <i className="icon-login"></i> Go to this version
                 <i className="icon-login"></i> Go to this version
               </a>
               </a>
             </p>
             </p>
@@ -61,5 +61,5 @@ Revision.propTypes = {
   revision: PropTypes.object,
   revision: PropTypes.object,
   revisionDiffOpened: PropTypes.bool.isRequired,
   revisionDiffOpened: PropTypes.bool.isRequired,
   onDiffOpenClicked: PropTypes.func.isRequired,
   onDiffOpenClicked: PropTypes.func.isRequired,
-}
+};
 
 

+ 1 - 1
resource/js/components/PageHistory/RevisionDiff.js

@@ -40,4 +40,4 @@ RevisionDiff.propTypes = {
   currentRevision: PropTypes.object.isRequired,
   currentRevision: PropTypes.object.isRequired,
   previousRevision: PropTypes.object.isRequired,
   previousRevision: PropTypes.object.isRequired,
   revisionDiffOpened: PropTypes.bool.isRequired,
   revisionDiffOpened: PropTypes.bool.isRequired,
-}
+};

+ 1 - 1
resource/js/components/PageList/ListView.js

@@ -7,7 +7,7 @@ export default class ListView extends React.Component {
 
 
   render() {
   render() {
     const listView = this.props.pages.map((page) => {
     const listView = this.props.pages.map((page) => {
-      return <Page page={page} key={"page-list:list-view:" + page._id} />;
+      return <Page page={page} key={'page-list:list-view:' + page._id} />;
     });
     });
 
 
     return (
     return (

+ 1 - 1
resource/js/components/PageList/Page.js

@@ -16,7 +16,7 @@ export default class Page extends React.Component {
 
 
     const styleFlex = {
     const styleFlex = {
       flex: 1
       flex: 1
-    }
+    };
 
 
     return (
     return (
       <li className="page-list-li d-flex align-items-center">
       <li className="page-list-li d-flex align-items-center">

+ 4 - 4
resource/js/components/PageListSearch.js

@@ -18,7 +18,7 @@ export default class PageListSearch extends React.Component {
       searchedPages: [],
       searchedPages: [],
       searchResultMeta: {},
       searchResultMeta: {},
       searchError: null,
       searchError: null,
-    }
+    };
 
 
     this.changeURL = this.changeURL.bind(this);
     this.changeURL = this.changeURL.bind(this);
     this.search = this.search.bind(this);
     this.search = this.search.bind(this);
@@ -92,9 +92,9 @@ export default class PageListSearch extends React.Component {
     let hash = location.hash || '';
     let hash = location.hash || '';
     // TODO 整理する
     // TODO 整理する
     if (refreshHash || this.state.searchedKeyword !== '') {
     if (refreshHash || this.state.searchedKeyword !== '') {
-        hash = '';
+      hash = '';
     }
     }
-    if (window.history && window.history.pushState){
+    if (window.history && window.history.pushState) {
       window.history.pushState('', `Search - ${keyword}`, `${tree}?q=${keyword}${hash}`);
       window.history.pushState('', `Search - ${keyword}`, `${tree}?q=${keyword}${hash}`);
     }
     }
   }
   }
@@ -133,7 +133,7 @@ export default class PageListSearch extends React.Component {
         searchError: err,
         searchError: err,
       });
       });
     });
     });
-  };
+  }
 
 
   render() {
   render() {
     return (
     return (

+ 2 - 2
resource/js/components/ReactUtils.js

@@ -14,10 +14,10 @@ export default class ReactUtils {
    * @memberOf ReactUtils
    * @memberOf ReactUtils
    */
    */
   static nl2br(text) {
   static nl2br(text) {
-    var regex = /(\n)/g
+    var regex = /(\n)/g;
     return text.split(regex).map(function(line) {
     return text.split(regex).map(function(line) {
       if (line.match(regex)) {
       if (line.match(regex)) {
-        return React.createElement('br', {key: Math.random().toString(10).substr(2, 10)})
+        return React.createElement('br', {key: Math.random().toString(10).substr(2, 10)});
       }
       }
       else {
       else {
         return line;
         return line;

+ 4 - 4
resource/js/components/SearchPage.js

@@ -18,7 +18,7 @@ export default class SearchPage extends React.Component {
       searchedPages: [],
       searchedPages: [],
       searchResultMeta: {},
       searchResultMeta: {},
       searchError: null,
       searchError: null,
-    }
+    };
 
 
     this.search = this.search.bind(this);
     this.search = this.search.bind(this);
     this.changeURL = this.changeURL.bind(this);
     this.changeURL = this.changeURL.bind(this);
@@ -47,9 +47,9 @@ export default class SearchPage extends React.Component {
     let hash = location.hash || '';
     let hash = location.hash || '';
     // TODO 整理する
     // TODO 整理する
     if (refreshHash || this.state.searchedKeyword !== '') {
     if (refreshHash || this.state.searchedKeyword !== '') {
-        hash = '';
+      hash = '';
     }
     }
-    if (window.history && window.history.pushState){
+    if (window.history && window.history.pushState) {
       window.history.pushState('', `Search - ${keyword}`, `/_search?q=${keyword}${hash}`);
       window.history.pushState('', `Search - ${keyword}`, `/_search?q=${keyword}${hash}`);
     }
     }
   }
   }
@@ -86,7 +86,7 @@ export default class SearchPage extends React.Component {
         searchError: err,
         searchError: err,
       });
       });
     });
     });
-  };
+  }
 
 
   render() {
   render() {
     return (
     return (