Browse Source

* Last fix

master
vvandenb 2 years ago
parent
commit
ab70a50554
  1. 3
      back/volume/src/chat/chat.controller.ts
  2. 1
      back/volume/src/chat/chat.gateway.ts
  3. 3
      front/volume/src/App.svelte
  4. 3
      front/volume/src/components/Channels.svelte
  5. 3
      front/volume/src/components/NavBar.svelte

3
back/volume/src/chat/chat.controller.ts

@ -62,7 +62,7 @@ export class ChatController {
): Promise<void> {
const channel = await this.channelService.getFullChannel(id)
const user: User | null = await this.usersService.getFullUser(target.id)
if (user == null) {
if (user == null || target === undefined) {
throw new NotFoundException(`User #${target.id} not found`)
}
if (!(await this.channelService.isUser(channel.id, +profile.id))) {
@ -76,7 +76,6 @@ export class ChatController {
if (await this.channelService.isBanned(channel.id, target.id)) {
throw new BadRequestException('User is banned from this channel')
}
user.socketKey = ''
channel.users.push(user)
await this.channelService.save(channel)
}

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

@ -56,7 +56,6 @@ export class ChatGateway implements OnGatewayConnection, OnGatewayDisconnect {
@SubscribeMessage('joinChannel')
async onJoinChannel(socket: Socket, connect: ConnectionDto): Promise<void> {
await this.connectedUserRepository.delete({ user: connect.UserId })
const channel = await this.chatService.getFullChannel(connect.ChannelId);
if (channel.banned.findIndex((ban) => +ban[0] === +connect.UserId) !== -1) {
this.server

3
front/volume/src/App.svelte

@ -169,7 +169,6 @@
{:else if $store.twoFA === true && $store.isVerified === false}
<h1><button type="button" on:click={verify}>verify</button></h1>
{:else}
<Navbar
{clickProfile}
{clickHistory}
@ -177,7 +176,9 @@
{clickChannels}
{clickLeaderboard}
{failedGameLogIn}
{gamePlaying}
/>
{#if appState.includes(`${APPSTATE.CHANNELS}#`)}
{#key appState}
<div

3
front/volume/src/components/Channels.svelte

@ -174,6 +174,7 @@
});
if (response.ok) {
const user = await response.json();
console.log(user)
const response2 = await fetch(API_URL + "/channels/" + id + "/invite", {
credentials: "include",
method: "POST",
@ -182,7 +183,7 @@
"Content-Type": "application/json",
},
body: JSON.stringify({
userId: user.ftId,
id: user.ftId
}),
});
if (response2.ok) {

3
front/volume/src/components/NavBar.svelte

@ -20,6 +20,7 @@
export let clickChannels = () => {};
export let clickLeaderboard = () => {};
export let failedGameLogIn: boolean;
export let gamePlaying: boolean;
let hide = true;
@ -28,7 +29,7 @@
}
</script>
<nav class="navigation-bar" style={ failedGameLogIn ? "display: none" : '' } >
<nav class="navigation-bar" style={ failedGameLogIn || gamePlaying ? "display: none" : '' } >
<ul>
<li>
<img src="img/pong.png" alt="home-icon" />

Loading…
Cancel
Save