fix: disable ability to leave publicChannels

This commit is contained in:
Chneemann 2024-09-17 18:15:13 +02:00
parent 0664fb9e48
commit 11def9cb0d
3 changed files with 9 additions and 1 deletions

View file

@ -159,6 +159,7 @@
[openUserWindowBoolean]="openUserWindowBoolean"
(closeUserWindow)="changeOpenUserWindowBoolean($event)"
></app-open-send-prv-message-window>
@if (!publicChannelsList.includes(currentChannel)) {
<div class="leaveChannel">
<button
[disabled]="openEditNameInput || openEditNameDescription"
@ -167,6 +168,7 @@
{{ "channel-information.leave" | translate }}
</button>
</div>
}
</div>
</div>
</div>

View file

@ -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.
*/

View file

@ -3,6 +3,7 @@ export const publicChannels: string[] = [
't0zOHsjKzq0uYSqsMx8j',
'UVeEk7NxpRZjdaNdNWom',
];
export interface Channel {
id?: string;
name: string;