diff --git a/back/src/chat/chat.service.ts b/back/src/chat/chat.service.ts index 39d5af5..86971a7 100644 --- a/back/src/chat/chat.service.ts +++ b/back/src/chat/chat.service.ts @@ -105,24 +105,16 @@ export class ChatService { return rooms } - @Cron('*/6 * * * * *') - async updateMutelists (): Promise { - const channels = await this.ChannelRepository.find({}) - channels.forEach((channel) => { - channel.muted = channel.muted.filter((data) => { - return Date.now() - data[1] < 0 - }) - void this.update(channel) - }) - } - - @Cron('*/6 * * * * *') + @Cron('*/10 * * * * *') async updateBanlists (): Promise { const channels = await this.ChannelRepository.find({}) for (const channel of channels) { channel.banned = channel.banned.filter((data) => { return Date.now() - data[1] < 0 }) + channel.muted = channel.muted.filter((data) => { + return Date.now() - data[1] < 0 + }) void this.update(channel) } } diff --git a/back/src/pong/pong.gateway.ts b/back/src/pong/pong.gateway.ts index bcf518b..34b35ca 100644 --- a/back/src/pong/pong.gateway.ts +++ b/back/src/pong/pong.gateway.ts @@ -150,6 +150,9 @@ export class PongGateway implements OnGatewayConnection, OnGatewayDisconnect { this.socketToPlayerName.get(key) === realGameCreationDto.playerNames[0] ) + const player1game: Game | undefined = this.games.playerGame( + realGameCreationDto.playerNames[0] + ) const player2Socket: Socket | undefined = Array.from( this.socketToPlayerName.keys() ).find( @@ -157,10 +160,15 @@ export class PongGateway implements OnGatewayConnection, OnGatewayDisconnect { this.socketToPlayerName.get(key) === realGameCreationDto.playerNames[1] ) + const player2game: Game | undefined = this.games.playerGame( + realGameCreationDto.playerNames[1] + ) if ( player1Socket !== undefined && player2Socket !== undefined && + player1game === undefined && + player2game === undefined && (client.id === player1Socket.id || client.id === player2Socket.id) && player1Socket.id !== player2Socket.id ) { diff --git a/back/src/users/users.service.ts b/back/src/users/users.service.ts index 256f3e1..13535b6 100644 --- a/back/src/users/users.service.ts +++ b/back/src/users/users.service.ts @@ -41,7 +41,7 @@ export class UsersService { return user } - @Cron('0 * * * * *') + @Cron('*/30 * * * * *') async updateStatus (): Promise { const users = await this.usersRepository.find({}) users.forEach((usr) => { diff --git a/front/src/components/Chat.svelte b/front/src/components/Chat.svelte index c57942f..9e581f2 100644 --- a/front/src/components/Chat.svelte +++ b/front/src/components/Chat.svelte @@ -191,13 +191,13 @@ body: JSON.stringify(body), }); if (response.ok) { - await show_popup(`User banned for: ${duration} seconds`, false); const data: kickUserDto = { chan: channel.id, from: $store.ftId, to: target.ftId, }; socket.emit("kickUser", data); + await show_popup(`User banned for: ${duration} seconds`, false); } else { const error = await response.json(); await show_popup(error.message, false)