From 02ab84add433939a17cc0bf0776ca54fb1bf6909 Mon Sep 17 00:00:00 2001 From: Alexandre POMMIER Date: Mon, 26 Jun 2023 06:05:14 +0200 Subject: [PATCH] mute work --- .gitignore | 4 ++-- containers/api/src/chat/chat.service.ts | 13 ++++++++++--- containers/react/.env | 10 +++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 4374dd6f..d9d0b8f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -# .env -# containers/react/.env +.env +containers/react/.env backend/node_modules/ containers/backend/dist/ diff --git a/containers/api/src/chat/chat.service.ts b/containers/api/src/chat/chat.service.ts index cbdfe6e3..e54980d3 100644 --- a/containers/api/src/chat/chat.service.ts +++ b/containers/api/src/chat/chat.service.ts @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/06/17 01:00:25 by apommier #+# #+# */ -/* Updated: 2023/06/26 04:11:00 by apommier ### ########.fr */ +/* Updated: 2023/06/26 05:09:02 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -82,6 +82,8 @@ async findConv(number: number){ async banUser(convId: number, username: string) { const conv = await this.findConv(convId); + if (conv.owner === username) + return (0); conv.banned = conv.banned || []; if (conv.banned.find(item => item === username)) { @@ -128,7 +130,12 @@ async muteUser(convId: number, username: string, time: string) { const conv = await this.findConv(convId); console.log("MUTE USER"); - + console.log("time = ", time); + console.log("int time = ", parseInt(time)); + const intTime = parseInt(time) * 1000; + console.log("intTime = ", intTime); + if (conv.owner === username) + return (0); conv.muted = conv.muted || []; if (conv.muted.find(item => item === username)) return (1); @@ -138,7 +145,7 @@ async muteUser(convId: number, username: string, time: string) { setTimeout(() => { conv.muted = conv.muted.filter((item) => item !== username) this.save(conv); - }, 5000); + }, intTime); console.log("END MUTE USER"); } diff --git a/containers/react/.env b/containers/react/.env index 0e54b8cc..728712a7 100644 --- a/containers/react/.env +++ b/containers/react/.env @@ -1,11 +1,11 @@ -REACT_APP_BASE_URL=localhost:8080 -REACT_APP_SOCKET_URL=localhost -REACT_APP_API_SECRET=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 -REACT_APP_CLIENT_UID=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41 +REACT_APP_BASE_URL=bess-f2r5s13:8080 +REACT_APP_SOCKET_URL=bess-f2r5s13 +REACT_APP_API_SECRET=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 +REACT_APP_CLIENT_UID=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789 # REACT_APP_BASE_URL=92.143.191.152 # REACT_APP_BASE_URL=192.168.1.19 -REACT_APP_INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fapi%2Fauth%2Flogin&response_type=code" +REACT_APP_INTRA_URL="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-2bd3c5d4f41e776f2e3d5d699d2a8421f6d0c0468ec882516d9ca89b0c211789&redirect_uri=http%3A%2F%2Fbess-f2r5s13%3A8080%2Fapi%2Fauth%2Flogin&response_type=code" # REACT_APP_BASE_URL=92.143.191.152 # REACT_APP_BASE_URL=192.168.1.19