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

View file

@ -1,7 +1,7 @@
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormsModule } from '@angular/forms'; 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 { ChannelService } from '../../../service/channel.service';
import { UserService } from '../../../service/user.service'; import { UserService } from '../../../service/user.service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
@ -37,6 +37,7 @@ export class ChannelInformationComponent {
getCurrentChannel: Channel[] = []; getCurrentChannel: Channel[] = [];
openUserWindowBoolean: boolean = false; openUserWindowBoolean: boolean = false;
user: User[] = []; user: User[] = [];
publicChannelsList: string[] = [];
constructor( constructor(
private route: Router, private route: Router,
@ -47,6 +48,10 @@ export class ChannelInformationComponent {
RESPONSIVE_THRESHOLD_MOBILE = this.sharedService.RESPONSIVE_THRESHOLD_MOBILE; RESPONSIVE_THRESHOLD_MOBILE = this.sharedService.RESPONSIVE_THRESHOLD_MOBILE;
ngOnInit(): void {
this.publicChannelsList = publicChannels;
}
/** /**
* Closes the menu by emitting a signal to close editing. * Closes the menu by emitting a signal to close editing.
*/ */

View file

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