From 4ec84dfc0624230043612e6f1d4d1352219bd84d Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 1 Apr 2020 17:55:44 +0200 Subject: [PATCH] Remove useless function argument --- src/controllers/UserWebSocketActions.ts | 4 ++-- src/controllers/UserWebSocketController.ts | 8 ++------ src/entities/WebSocketRequestHandler.ts | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/controllers/UserWebSocketActions.ts b/src/controllers/UserWebSocketActions.ts index 3ae7990..10311c7 100644 --- a/src/controllers/UserWebSocketActions.ts +++ b/src/controllers/UserWebSocketActions.ts @@ -87,7 +87,7 @@ export class UserWebSocketActions { continue; // Notify user - UserWebSocketController.Send(userID, "", new WsMessage({ + UserWebSocketController.Send(userID, new WsMessage({ title: "number_notifs", id: "", data: await NotificationsHelper.CountUnread(userID) @@ -108,7 +108,7 @@ export class UserWebSocketActions { continue; // Notify user - UserWebSocketController.Send(userID, "", new WsMessage({ + UserWebSocketController.Send(userID, new WsMessage({ title: "number_unread_conversations", id: "", data: await ConversationsHelper.CountUnreadForUser(userID) diff --git a/src/controllers/UserWebSocketController.ts b/src/controllers/UserWebSocketController.ts index 0bf4066..f995600 100644 --- a/src/controllers/UserWebSocketController.ts +++ b/src/controllers/UserWebSocketController.ts @@ -212,14 +212,10 @@ export class UserWebSocketController { * Send a message to a socket * * @param userID Target user ID - * @param socketID Target socket ID (if null the message is sent to - * all the active sockets of the user) * @param message The message to send */ - public static Send(userID: number, socketID: string, message: WsMessage) { - for(const entry of this.active_clients.filter( - (e) => e.userID == userID - && (socketID.length == 0 || e.socketID == socketID))) + public static Send(userID: number, message: WsMessage) { + for(const entry of this.active_clients.filter((e) => e.userID == userID)) { this.SendToClient(entry, message); } diff --git a/src/entities/WebSocketRequestHandler.ts b/src/entities/WebSocketRequestHandler.ts index 1d364fc..b6f22d8 100644 --- a/src/entities/WebSocketRequestHandler.ts +++ b/src/entities/WebSocketRequestHandler.ts @@ -56,7 +56,7 @@ export class UserWebSocketRequestsHandler extends BaseRequestsHandler { throw new Error("Trying to send a response to a request to which a response has already been sent!") // Send the response - UserWebSocketController.Send(this.wsClient.userID, this.wsClient.socketID, new WsMessage({ + UserWebSocketController.SendToClient(this.wsClient, new WsMessage({ title: title, data: data, id: this.req.id