1.0.0.rc1 #244
@ -185,14 +185,14 @@
|
||||
<td>
|
||||
<div class="btn-wrapper">
|
||||
<button *ngIf="!editing" pButton pInitEditableRow class="btn icon-btn" icon="pi pi-pencil"
|
||||
(click)="onRowEditInit(dt, level, ri)"></button>
|
||||
(click)="onRowEditInit(dt, level, ri)" [disabled]="!user || user.isModerator && !user.isAdmin"></button>
|
||||
<button *ngIf="!editing" pButton class="btn icon-btn danger-icon-btn" icon="pi pi-trash"
|
||||
(click)="deleteLevel(level)"></button>
|
||||
(click)="deleteLevel(level)" [disabled]="!user || user.isModerator && !user.isAdmin"></button>
|
||||
|
||||
<button *ngIf="editing" pButton pSaveEditableRow class="btn icon-btn"
|
||||
icon="pi pi-check-circle" (click)="onRowEditSave(dt, level, ri)"></button>
|
||||
icon="pi pi-check-circle" (click)="onRowEditSave(dt, level, ri)" [disabled]="!user || user.isModerator && !user.isAdmin"></button>
|
||||
<button *ngIf="editing" pButton pCancelEditableRow class="btn icon-btn danger-icon-btn"
|
||||
icon="pi pi-times-circle" (click)="onRowEditCancel(ri)"></button>
|
||||
icon="pi pi-times-circle" (click)="onRowEditCancel(ri)" [disabled]="!user || user.isModerator && !user.isAdmin"></button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -21,6 +21,7 @@ import { LevelMutationResult, UpdateUserMutationResult } from "../../../../../..
|
||||
import { Mutations } from "../../../../../../models/graphql/mutations.model";
|
||||
import { Subject, throwError } from "rxjs";
|
||||
import { Server } from "../../../../../../models/data/server.model";
|
||||
import { UserDTO } from "../../../../../../models/auth/auth-user.dto";
|
||||
|
||||
@Component({
|
||||
selector: "app-levels",
|
||||
@ -58,6 +59,7 @@ export class LevelsComponent implements OnInit, OnDestroy {
|
||||
|
||||
private unsubscriber = new Subject<void>();
|
||||
private server: Server = {};
|
||||
public user: UserDTO | null = null;
|
||||
|
||||
public constructor(
|
||||
private authService: AuthService,
|
||||
@ -73,9 +75,11 @@ export class LevelsComponent implements OnInit, OnDestroy {
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.setFilterForm();
|
||||
this.data.getServerFromRoute(this.route).then(server => {
|
||||
this.data.getServerFromRoute(this.route).then(async server => {
|
||||
this.server = server;
|
||||
this.loadNextPage();
|
||||
let authUser = await this.authService.getLoggedInUser();
|
||||
this.user = authUser?.users?.find(u => u.server == this.server.id) ?? null;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -140,8 +140,8 @@ export class SidebarService {
|
||||
if (this.server$.value) {
|
||||
this.serverMenu.visible = true;
|
||||
this.serverMembers.visible = !!user?.isModerator;
|
||||
this.serverAutoRoles.visible = !!user?.isAdmin;
|
||||
this.serverLevels.visible = !!user?.isAdmin;
|
||||
this.serverAutoRoles.visible = !!user?.isModerator;
|
||||
this.serverLevels.visible = !!user?.isModerator;
|
||||
} else {
|
||||
this.serverMenu.visible = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user