kaori 4 лет назад
Родитель
Сommit
452e35b841

+ 3 - 3
packages/app/src/server/models/in-app-notification.ts

@@ -43,7 +43,7 @@ export interface InAppNotificationModel extends Model<InAppNotificationDocument>
 }
 
 export default (crowi: Crowi) => {
-  const inAppNotificationEvent = crowi.event('inAppNotification');
+  const inAppCommentEvent = crowi.event('inAppNotification');
 
   const inAppNotificationSchema = new Schema<InAppNotificationDocument, InAppNotificationModel>({
     user: {
@@ -140,7 +140,7 @@ export default (crowi: Crowi) => {
     const inAppNotification = await InAppNotification.findOneAndUpdate(query, parameters, options);
 
     if (inAppNotification) {
-      inAppNotificationEvent.emit('update', inAppNotification.user);
+      inAppCommentEvent.emit('update', inAppNotification.user);
     }
 
     return inAppNotification;
@@ -175,7 +175,7 @@ export default (crowi: Crowi) => {
 
     const inAppNotification = await InAppNotification.findOneAndUpdate(query, parameters, options);
     if (inAppNotification) {
-      inAppNotificationEvent.emit('update', inAppNotification.user);
+      inAppCommentEvent.emit('update', inAppNotification.user);
     }
     return inAppNotification;
   };

+ 5 - 5
packages/app/src/server/service/notification.ts

@@ -6,24 +6,24 @@ class NortificationService {
 
   socketIoService!: any;
 
-  notificationEvent!: any;
+  commentEvent!: any;
 
 
   constructor(crowi: Crowi) {
     this.crowi = crowi;
     this.socketIoService = crowi.socketIoService;
-    this.notificationEvent = crowi.event('notification');
+    this.commentEvent = crowi.event('comment');
 
     // init
     this.updateNotificationevent();
   }
 
   updateNotificationevent() {
-    this.notificationEvent.on('update', (user) => {
-      this.notificationEvent.onUpdate();
+    this.commentEvent.on('update', (user) => {
+      this.commentEvent.onUpdate();
 
       if (this.socketIoService.isInitialized) {
-        this.socketIoService.getDefaultSocket().emit('notification updated', { user });
+        this.socketIoService.getDefaultSocket().emit('comment updated', { user });
       }
     });
   }