itizawa 5 лет назад
Родитель
Сommit
3f2794ed89
1 измененных файлов с 12 добавлено и 16 удалено
  1. 12 16
      src/server/routes/apiv3/pages.js

+ 12 - 16
src/server/routes/apiv3/pages.js

@@ -237,14 +237,12 @@ module.exports = (crowi) => {
       Page.applyScopesToDescendantsAsyncronously(createdPage, req.user);
     }
 
-    // global notification
-    if (globalNotificationService != null) {
-      try {
-        await globalNotificationService.fire(GlobalNotificationSetting.EVENT.PAGE_CREATE, createdPage, req.user);
-      }
-      catch (err) {
-        logger.error('Create grobal notification failed', err);
-      }
+    try {
+      // global notification
+      await globalNotificationService.fire(GlobalNotificationSetting.EVENT.PAGE_CREATE, createdPage, req.user);
+    }
+    catch (err) {
+      logger.error('Create grobal notification failed', err);
     }
 
     // user notification
@@ -493,14 +491,12 @@ module.exports = (crowi) => {
     const originTags = await page.findRelatedTagsById();
     const savedTags = await saveTagsAction({ page, createdPage, pageTags: originTags });
 
-    // global notification
-    if (globalNotificationService != null) {
-      try {
-        await globalNotificationService.fire(GlobalNotificationSetting.EVENT.PAGE_CREATE, createdPage, user);
-      }
-      catch (err) {
-        logger.error('Create grobal notification failed', err);
-      }
+    try {
+      // global notification
+      await globalNotificationService.fire(GlobalNotificationSetting.EVENT.PAGE_CREATE, createdPage, user);
+    }
+    catch (err) {
+      logger.error('Create grobal notification failed', err);
     }
 
     return { page: pageService.serializeToObj(createdPage), tags: savedTags };