Fix only creator can remove/add admins

master
Max 5 years ago
parent becbb0a73f
commit 787008ebfb

@ -136,7 +136,7 @@
<mat-card-subtitle class="pointer" (click)="showUserProfile(user)">{{user.handle}}</mat-card-subtitle> <mat-card-subtitle class="pointer" (click)="showUserProfile(user)">{{user.handle}}</mat-card-subtitle>
<mat-card-subtitle *ngIf="user.isGroupAdmin" class="pointer" (click)="showUserProfile(user)">[admin] <mat-card-subtitle *ngIf="user.isGroupAdmin" class="pointer" (click)="showUserProfile(user)">[admin]
</mat-card-subtitle> </mat-card-subtitle>
<div id="icon-box" *ngIf="isAdmin"> <div id="icon-box" *ngIf="isCreator">
<button mat-icon-button [matMenuTriggerFor]="menu"> <button mat-icon-button [matMenuTriggerFor]="menu">
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>

@ -76,6 +76,7 @@ export class GroupComponent implements OnInit {
self: User; self: User;
id: string; id: string;
isAdmin = false; isAdmin = false;
isCreator = false;
groupNotFound = false; groupNotFound = false;
loading = false; loading = false;
@ -120,6 +121,11 @@ export class GroupComponent implements OnInit {
this.isAdmin = true; this.isAdmin = true;
} }
} }
if (this.groupProfile.creator.userID === this.self.userID) {
this.isCreator = true;
} else {
this.isCreator = false;
}
for (const member of this.groupProfile.members) { for (const member of this.groupProfile.members) {
member.allowedToSendRequest = this.requestService.isAllowedToSendRequest(member.userID, this.self); member.allowedToSendRequest = this.requestService.isAllowedToSendRequest(member.userID, this.self);
} }

Loading…
Cancel
Save