From 11def9cb0d036e1f594cb6a071139d657f0664b5 Mon Sep 17 00:00:00 2001 From: Chneemann Date: Tue, 17 Sep 2024 18:15:13 +0200 Subject: [PATCH] fix: disable ability to leave publicChannels --- .../channel-information/channel-information.component.html | 2 ++ .../channel-information/channel-information.component.ts | 7 ++++++- src/app/interface/channel.interface.ts | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/components/main-chat/channel-information/channel-information.component.html b/src/app/components/main-chat/channel-information/channel-information.component.html index 0fac958..7dc359b 100644 --- a/src/app/components/main-chat/channel-information/channel-information.component.html +++ b/src/app/components/main-chat/channel-information/channel-information.component.html @@ -159,6 +159,7 @@ [openUserWindowBoolean]="openUserWindowBoolean" (closeUserWindow)="changeOpenUserWindowBoolean($event)" > + @if (!publicChannelsList.includes(currentChannel)) {
+ } diff --git a/src/app/components/main-chat/channel-information/channel-information.component.ts b/src/app/components/main-chat/channel-information/channel-information.component.ts index 60698a8..6975f0b 100644 --- a/src/app/components/main-chat/channel-information/channel-information.component.ts +++ b/src/app/components/main-chat/channel-information/channel-information.component.ts @@ -1,7 +1,7 @@ import { CommonModule } from '@angular/common'; import { Component, EventEmitter, Input, Output } from '@angular/core'; import { FormsModule } from '@angular/forms'; -import { Channel } from '../../../interface/channel.interface'; +import { Channel, publicChannels } from '../../../interface/channel.interface'; import { ChannelService } from '../../../service/channel.service'; import { UserService } from '../../../service/user.service'; import { Router } from '@angular/router'; @@ -37,6 +37,7 @@ export class ChannelInformationComponent { getCurrentChannel: Channel[] = []; openUserWindowBoolean: boolean = false; user: User[] = []; + publicChannelsList: string[] = []; constructor( private route: Router, @@ -47,6 +48,10 @@ export class ChannelInformationComponent { RESPONSIVE_THRESHOLD_MOBILE = this.sharedService.RESPONSIVE_THRESHOLD_MOBILE; + ngOnInit(): void { + this.publicChannelsList = publicChannels; + } + /** * Closes the menu by emitting a signal to close editing. */ diff --git a/src/app/interface/channel.interface.ts b/src/app/interface/channel.interface.ts index 84890c0..e084c04 100644 --- a/src/app/interface/channel.interface.ts +++ b/src/app/interface/channel.interface.ts @@ -3,6 +3,7 @@ export const publicChannels: string[] = [ 't0zOHsjKzq0uYSqsMx8j', 'UVeEk7NxpRZjdaNdNWom', ]; + export interface Channel { id?: string; name: string;