Browse Source

kick on addMessage to removed channel

master
Pheuw1 2 years ago
parent
commit
5c2b06b556
  1. 26
      .env_sample
  2. 2
      Makefile
  3. 2
      back/volume/src/auth/mails/confirm.hbs
  4. 5
      back/volume/src/chat/chat.gateway.ts
  5. 2
      list

26
.env_sample

@ -1,26 +0,0 @@
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_USER=postgres_usr
POSTGRES_PASSWORD=postgres_pw
POSTGRES_DB=transcendence
PGADMIN_DEFAULT_EMAIL=admin@pg.com
PGADMIN_DEFAULT_PASSWORD=admin
MAIL_USER=vaganiwast@gmail.com
MAIL_PASSWORD=
FRONT_FPS=144
HOST=localhost
VITE_HOST=localhost
FRONT_PORT=80
BACK_PORT=3001
HASH_SALT=10
JWT_SECRET=test
JWT_EXPIRATION_TIME=900
FT_OAUTH_CLIENT_ID=
FT_OAUTH_CLIENT_SECRET=
FT_OAUTH_CALLBACK_URL=http://$HOST:$BACK_PORT/log/inReturn

2
Makefile

@ -4,7 +4,7 @@ USER = gavaniwast
all: clean dev
dev:
NODE_ENV="development" docker-compose up --build
NODE_ENV="development" docker compose up --build
check:
NODE_ENV="check" docker-compose run back --build

2
back/volume/src/auth/mails/confirm.hbs

@ -8,7 +8,7 @@
<body>
<h2>Hello {{username}}! </h2>
<p> Once you clicked on the next verify button, you will have access to the app</p>
<form action="http://localhost:3001/log/verify" method="post">
<form action="http://c2r7p5:3001/log/verify" method="post">
<button type="submit" name="code" value={{code}}>Verify</button>
</form>
</body>

5
back/volume/src/chat/chat.gateway.ts

@ -109,6 +109,10 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect {
@SubscribeMessage('addMessage')
async onAddMessage(socket: Socket, message: CreateMessageDto): Promise<void> {
const channel = await this.chatService.getChannel(message.ChannelId);
if (channel == null) {
this.server.to(socket.id).emit('kicked')
throw new WsException('Channel has been removed by owner');
}
if (await this.chatService.isMuted(channel.id, message.UserId)) {
throw new WsException('You are muted');
}
@ -136,7 +140,6 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect {
})) as ConnectedUser
if (connect) {
console.log(`kicking ${user.username} from ${channel.name} with socket ${connect.socket}`)
// this.server.sockets.sockets.get(connect.socket)?.emit('kicked');
this.server.to(connect.socket).emit('kicked')
}
}

2
list

@ -0,0 +1,2 @@
- manage users on deleting channel
- delete
Loading…
Cancel
Save