]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/peertube-socket.ts
Add bulk comment actions on account dropdown
[github/Chocobozzz/PeerTube.git] / server / lib / peertube-socket.ts
index 17748fd1813186509ab5c63a54ebfc8771475703..26ced351f3333cf1dfe756dc333ad95653c9ff88 100644 (file)
@@ -1,8 +1,8 @@
 import * as SocketIO from 'socket.io'
 import { authenticateSocket } from '../middlewares'
-import { UserNotificationModel } from '../models/account/user-notification'
 import { logger } from '../helpers/logger'
 import { Server } from 'http'
+import { UserNotificationModelForApi } from '@server/typings/models/user'
 
 class PeerTubeSocket {
 
@@ -34,13 +34,14 @@ class PeerTubeSocket {
       })
   }
 
-  sendNotification (userId: number, notification: UserNotificationModel) {
+  sendNotification (userId: number, notification: UserNotificationModelForApi) {
     const sockets = this.userNotificationSockets[userId]
 
     if (!sockets) return
 
+    const notificationMessage = notification.toFormattedJSON()
     for (const socket of sockets) {
-      socket.emit('new-notification', notification.toFormattedJSON())
+      socket.emit('new-notification', notificationMessage)
     }
   }