diff --git a/back/volume/src/chat/chat.gateway.ts b/back/volume/src/chat/chat.gateway.ts index 0b2d638..b81298a 100644 --- a/back/volume/src/chat/chat.gateway.ts +++ b/back/volume/src/chat/chat.gateway.ts @@ -38,6 +38,7 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect { async handleDisconnect (socket: Socket): Promise { await this.onLeaveChannel(socket) + socket.disconnect() } @SubscribeMessage('joinChannel') @@ -84,7 +85,6 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect { async onLeaveChannel (socket: Socket): Promise { const id = socket.id as any await this.connectedUserRepository.delete({ socket: id }) - socket.disconnect() } @SubscribeMessage('addMessage') @@ -99,7 +99,8 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect { const createdMessage: Message = await this.messageService.createMessage( message ) - socket.in(channel.toString()).emit('newMessage', createdMessage) + console.log(createdMessage) + socket.in(channel.id.toString()).emit('newMessage', createdMessage) } @SubscribeMessage('kickUser') diff --git a/front/volume/src/components/Channels.svelte b/front/volume/src/components/Channels.svelte index 1e47afd..43acb67 100644 --- a/front/volume/src/components/Channels.svelte +++ b/front/volume/src/components/Channels.svelte @@ -187,9 +187,11 @@ on:keydown={() => removeChannel(_channels.id)}>🗑️ + {#if _channels.isPrivate} + {/if} {/each} {:else} @@ -227,7 +229,7 @@ } .channels { - background-color: #5f5e5e; + background-color: #343a40; border: 1px solid #dedede; border-radius: 5px; padding: 1rem; diff --git a/front/volume/src/components/Chat.svelte b/front/volume/src/components/Chat.svelte index 67fee85..0b02be8 100644 --- a/front/volume/src/components/Chat.svelte +++ b/front/volume/src/components/Chat.svelte @@ -29,14 +29,15 @@ }); socket.on("newMessage", (msg: chatMessagesType) => { + console.log(msg) chatMessages = [...chatMessages, msg]; }); onDestroy(() => { - io.emit("LeaveChanel", async (response) => { + socket.emit("LeaveChanel", async (response) => { console.log(response.status); }); - io.disconnect(); + socket.disconnect(); }); //--------------------------------------------------------------------------------/ @@ -378,9 +379,9 @@ justify-content: center; align-items: center; } - + .chat { - background-color: #5f5e5e; + background-color: #343a40; border: 1px solid #dedede; border-radius: 5px; padding: 1rem;