Skip to content

Commit

Permalink
channelLeaved emitted
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Jaros committed Apr 6, 2023
1 parent 29def02 commit 24a851c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions back/nest_project/src/chat/chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,18 @@ export class ChatService {
let socketMap = roomHandler.userMap.get(userId);
if (socketMap != undefined) {
socketMap.emit("leaveChannel", channelId);
let channel: IChannelToEmit = await this.channelService.getOneById(channelId);
socketMap.sockets.forEach((user, socket) => {
socket.emit("channelLeaved", channel);
if (user.isChannel && user.room == channelId) {
roomHandler.joinRoom(userId, socket, 'general', true, false, false, false);
this.goBackToGeneral(socket);
}
});
}
let chan: ChannelEntity = await this.channelService.getOneById(channelId);
if (chan == null)
roomHandler.roomKill(channelId);
// let chan: ChannelEntity = await this.channelService.getOneById(channelId);
// if (chan == null)
// roomHandler.roomKill(channelId);
}

public connectEvent(client: Socket, user: UserEntity, chatNamespace: Namespace, roomHandler: UserRoomHandler, logger: Logger) {
Expand Down

0 comments on commit 24a851c

Please sign in to comment.