X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fpeertube-socket.ts;h=2e4b15b380e16f5f772e6e3c8629569a6f32d6b1;hb=963023abe6acf31799f6474d78489c8013f664fa;hp=17748fd1813186509ab5c63a54ebfc8771475703;hpb=015d9dec91ecb7a17e4e79407d187aac8a19206d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/peertube-socket.ts b/server/lib/peertube-socket.ts index 17748fd18..2e4b15b38 100644 --- a/server/lib/peertube-socket.ts +++ b/server/lib/peertube-socket.ts @@ -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/types/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) } }