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

variable name, indent, spacing

sou 7 лет назад
Родитель
Сommit
7df9f70d16
4 измененных файлов с 23 добавлено и 21 удалено
  1. 2 2
      lib/crowi/index.js
  2. 1 1
      lib/routes/admin.js
  3. 2 2
      lib/routes/comment.js
  4. 18 16
      lib/routes/page.js

+ 2 - 2
lib/crowi/index.js

@@ -463,9 +463,9 @@ Crowi.prototype.require = function(modulePath) {
  * setup GlobalNotificationService
  */
 Crowi.prototype.setUpGlobalNotification = function() {
-  const globalNotificationService = require('../service/global-notification');
+  const GlobalNotificationService = require('../service/global-notification');
   if (this.globalNotificationService == null) {
-    this.globalNotificationService = new globalNotificationService(this);
+    this.globalNotificationService = new GlobalNotificationService(this);
   }
 };
 

+ 1 - 1
lib/routes/admin.js

@@ -1158,7 +1158,7 @@ module.exports = function(crowi, app) {
   };
 
   actions.api.toggleIsEnabledForGlobalNotification = async(req, res) => {
-    const id =req.query.id;
+    const id = req.query.id;
 
     try {
       await GlobalNotificationSetting.Parent.toggleIsEnabled(id);

+ 2 - 2
lib/routes/comment.js

@@ -7,7 +7,7 @@ module.exports = function(crowi, app) {
     , User = crowi.model('User')
     , Page = crowi.model('Page')
     , ApiResponse = require('../util/apiResponse')
-    , notification = crowi.getGlobalNotificationService()
+    , globalNotificationService = crowi.getGlobalNotificationService()
     , actions = {}
     , api = {};
 
@@ -83,7 +83,7 @@ module.exports = function(crowi, app) {
     const path = page.path;
 
     // global notification
-    notification.notifyComment(createdComment, path);
+    globalNotificationService.notifyComment(createdComment, path);
 
     // slack notification
     if (slackNotificationForm.isSlackEnabled) {

+ 18 - 16
lib/routes/page.js

@@ -16,7 +16,7 @@ module.exports = function(crowi, app) {
     , pagePathUtil = require('../util/pagePathUtil')
     , swig = require('swig-templates')
     , getToday = require('../util/getToday')
-    , notification = crowi.getGlobalNotificationService()
+    , globalNotificationService = crowi.getGlobalNotificationService()
 
     , actions = {};
 
@@ -705,21 +705,21 @@ module.exports = function(crowi, app) {
       if (data) {
         previousRevision = data.revision;
         return Page.updatePage(data, body, req.user, { grant, grantUserGroupId })
-        .then((page) => {
-          // global notification
-          notification.notifyPageEdit(page);
-          return page;
-        });
+          .then((page) => {
+            // global notification
+            globalNotificationService.notifyPageEdit(page);
+            return page;
+          });
       }
       else {
         // new page
         updateOrCreate = 'create';
         return Page.create(path, body, req.user, { grant, grantUserGroupId })
-        .then((page) => {
-          // global notification
-          notification.notifyPageCreate(page);
-          return page;
-        });
+          .then((page) => {
+            // global notification
+            globalNotificationService.notifyPageCreate(page);
+            return page;
+          });
       }
     }).then(function(data) {
       // data is a saved page data with revision.
@@ -1001,17 +1001,19 @@ module.exports = function(crowi, app) {
     Page.findPageByIdAndGrantedUser(id, req.user)
     .then(function(pageData) {
       return pageData.like(req.user);
-    }).then(function(page) {
+    })
+    .then(function(page) {
       var result = {page: page};
       res.json(ApiResponse.success(result));
       return page;
-    }).catch(function(err) {
+    })
+    .catch(function(err) {
       debug('Like failed', err);
       return res.json(ApiResponse.error({}));
     })
     .then((page) => {
       // global notification
-      return notification.notifyPageLike(page, req.user);
+      return globalNotificationService.notifyPageLike(page, req.user);
     });
   };
 
@@ -1121,7 +1123,7 @@ module.exports = function(crowi, app) {
     })
     .then((page) => {
       // global notification
-      return notification.notifyPageDelete(page);
+      return globalNotificationService.notifyPageDelete(page);
     });
   };
 
@@ -1218,7 +1220,7 @@ module.exports = function(crowi, app) {
       })
       .then(() => {
         // global notification
-        notification.notifyPageMove(page, req.body.path, req.user);
+        globalNotificationService.notifyPageMove(page, req.body.path, req.user);
       });
     });