From 25f25815f5c5a56884ac40f853e5a240c59bccc6 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 2 Apr 2020 10:57:38 +0200 Subject: [PATCH] Notify of comment update --- src/controllers/UserWebSocketActions.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/controllers/UserWebSocketActions.ts b/src/controllers/UserWebSocketActions.ts index 644ce33..0b1923b 100644 --- a/src/controllers/UserWebSocketActions.ts +++ b/src/controllers/UserWebSocketActions.ts @@ -163,7 +163,13 @@ export class UserWebSocketActions { public static async UpdatedComment(commentID: number) { const comment = await CommentsHelper.GetSingle(commentID); - console.info(comment) + 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, true) + })) + } } }