wip unblock socket
This commit is contained in:
@@ -532,10 +532,25 @@ export class ChatController {
|
||||
{
|
||||
printCaller("- in ");
|
||||
|
||||
await this.chatService.setBlockUser(req.user.username, username);
|
||||
let user_socket: socketDto = this.chatGateway.sockets.get(req.user.username);
|
||||
user_socket.join(`${username}_not_emit`);
|
||||
|
||||
res.status(HttpStatus.OK).json({ message: "successfull unmute" });
|
||||
res.status(HttpStatus.OK).json({ message: "successfull block" });
|
||||
printCaller("- out ");
|
||||
}
|
||||
|
||||
@UseGuards(AuthenticateGuard)
|
||||
@UseGuards(TwoFactorGuard)
|
||||
@Post('unblock')
|
||||
async unBlockUser(@Body('username') username: string, @Req() req, @Res() res): Promise<void>
|
||||
{
|
||||
printCaller("- in ");
|
||||
|
||||
let user_socket: socketDto = this.chatGateway.sockets.get(req.user.username);
|
||||
user_socket.leave(`${username}_not_emit`);
|
||||
|
||||
res.status(HttpStatus.OK).json({ message: "successfull unblock" });
|
||||
printCaller("- out ");
|
||||
}
|
||||
|
||||
|
||||
@@ -298,6 +298,14 @@ export class ChatService {
|
||||
printCaller("-- out ");
|
||||
}
|
||||
|
||||
async setBlockUser(username: string, to_block_username: string): Promise<void>
|
||||
{
|
||||
printCaller("-- in ");
|
||||
|
||||
|
||||
printCaller("-- out ");
|
||||
}
|
||||
|
||||
/* ADDERS *************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export class User {
|
||||
email: string;
|
||||
|
||||
@Column()
|
||||
image_url : string;
|
||||
image_url: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
phone: string;
|
||||
@@ -57,4 +57,7 @@ export class User {
|
||||
|
||||
@Column({ nullable: true })
|
||||
currentRoom: string; // chatroom name
|
||||
|
||||
@Column("simple-array", { nullable: true })
|
||||
blockedUsers: string[]; // usernames
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user