From 4ffcebb2e480f27f3a63ff6c9b5802c6051c3f02 Mon Sep 17 00:00:00 2001 From: Alban Bruder Date: Mon, 20 Dec 2021 13:53:54 +0100 Subject: [PATCH 1/2] Use specified type in admin message --- back/src/RoomManager.ts | 2 +- back/src/Services/SocketManager.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/back/src/RoomManager.ts b/back/src/RoomManager.ts index 8dbde018..b68fe824 100644 --- a/back/src/RoomManager.ts +++ b/back/src/RoomManager.ts @@ -251,7 +251,7 @@ const roomManager: IRoomManagerServer = { }, sendAdminMessage(call: ServerUnaryCall, callback: sendUnaryData): void { socketManager - .sendAdminMessage(call.request.getRoomid(), call.request.getRecipientuuid(), call.request.getMessage()) + .sendAdminMessage(call.request.getRoomid(), call.request.getRecipientuuid(), call.request.getMessage(), call.request.getType()) .catch((e) => console.error(e)); callback(null, new EmptyMessage()); diff --git a/back/src/Services/SocketManager.ts b/back/src/Services/SocketManager.ts index 8989df75..a5f53f4c 100644 --- a/back/src/Services/SocketManager.ts +++ b/back/src/Services/SocketManager.ts @@ -691,7 +691,7 @@ export class SocketManager { } } - public async sendAdminMessage(roomId: string, recipientUuid: string, message: string): Promise { + public async sendAdminMessage(roomId: string, recipientUuid: string, message: string, type: string): Promise { const room = await this.roomsPromises.get(roomId); if (!room) { console.error( @@ -715,7 +715,7 @@ export class SocketManager { for (const recipient of recipients) { const sendUserMessage = new SendUserMessage(); sendUserMessage.setMessage(message); - sendUserMessage.setType("ban"); //todo: is the type correct? + sendUserMessage.setType(type); const serverToClientMessage = new ServerToClientMessage(); serverToClientMessage.setSendusermessage(sendUserMessage); From d185c0ee2455e44044a3479796c47bc535f8a079 Mon Sep 17 00:00:00 2001 From: Alban Bruder Date: Mon, 20 Dec 2021 15:14:49 +0100 Subject: [PATCH 2/2] fix code styling --- back/src/RoomManager.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/back/src/RoomManager.ts b/back/src/RoomManager.ts index b68fe824..322c9b46 100644 --- a/back/src/RoomManager.ts +++ b/back/src/RoomManager.ts @@ -251,7 +251,12 @@ const roomManager: IRoomManagerServer = { }, sendAdminMessage(call: ServerUnaryCall, callback: sendUnaryData): void { socketManager - .sendAdminMessage(call.request.getRoomid(), call.request.getRecipientuuid(), call.request.getMessage(), call.request.getType()) + .sendAdminMessage( + call.request.getRoomid(), + call.request.getRecipientuuid(), + call.request.getMessage(), + call.request.getType() + ) .catch((e) => console.error(e)); callback(null, new EmptyMessage());