mute work

This commit is contained in:
Alexandre POMMIER 2023-06-26 06:05:14 +02:00
parent 8ebeabb386
commit 02ab84add4
3 changed files with 17 additions and 10 deletions

4
.gitignore vendored
View File

@ -1,5 +1,5 @@
# .env
# containers/react/.env
.env
containers/react/.env
backend/node_modules/
containers/backend/dist/

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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");
}

View File

@ -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