diff --git a/src/controllers/UserWebSocketActions.ts b/src/controllers/UserWebSocketActions.ts index 2bf5621..003e14c 100644 --- a/src/controllers/UserWebSocketActions.ts +++ b/src/controllers/UserWebSocketActions.ts @@ -150,16 +150,11 @@ export class UserWebSocketActions { * @param c New comment */ public static async CreatedNewComment(c: Comment) { - - for(const client of UserWebSocketController.active_clients.filter((e) => e.registeredPosts.has(c.postID))) { - - UserWebSocketController.SendToClient(client, new WsMessage({ - id: "", - title: "new_comment", - data: await CommentsController.CommentToAPI(new AbritraryUserConnection(client.userID), c, true) - })) - - } + await UserWebSocketController.SendToSpecifcClients( + (e) => e.registeredPosts.has(c.postID), + async (client) => WsMessage.NoIDMessage("new_comment", + await CommentsController.CommentToAPI(new AbritraryUserConnection(client.userID), c, true)) + ) } /**