From cda807ae65262585e35d11126b945923638d49e2 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 2 Apr 2020 19:03:31 +0200 Subject: [PATCH] Update method --- src/controllers/UserWebSocketActions.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/controllers/UserWebSocketActions.ts b/src/controllers/UserWebSocketActions.ts index 003e14c..344f6c6 100644 --- a/src/controllers/UserWebSocketActions.ts +++ b/src/controllers/UserWebSocketActions.ts @@ -165,13 +165,11 @@ export class UserWebSocketActions { public static async UpdatedComment(commentID: number) { const comment = await CommentsHelper.GetSingle(commentID); - for(const client of UserWebSocketController.active_clients.filter((e) => e.registeredPosts.has(comment.postID))) { - UserWebSocketController.SendToClient(client, new WsMessage({ - id: "", - title: "comment_updated", - data: await CommentsController.CommentToAPI(new AbritraryUserConnection(client.userID), comment) - })) - } + await UserWebSocketController.SendToSpecifcClients( + (e) => e.registeredPosts.has(comment.postID), + async (client) => WsMessage.NoIDMessage("comment_updated", + await CommentsController.CommentToAPI(new AbritraryUserConnection(client.userID), comment)) + ) } /**