Fix add/remove admin

master
Max 5 years ago
parent 8cc25f0327
commit 52c7b96e16

@ -1,5 +1,5 @@
import {Component, OnInit, ViewChild} from '@angular/core';
import {Levellist} from '../../models/levellist';
import {LevelList} from '../../models/levellist';
import {ActivityService} from '../../services/activity/activity.service';
import {Activitylist} from '../../models/activity';
import {MatTableDataSource} from '@angular/material/table';

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

@ -111,8 +111,8 @@ export class GroupComponent implements OnInit {
});
this.groupService.getGroupData(this.id).subscribe();
this.groupService.group.subscribe(response => {
this.isAdmin = false;
if (response) {
this.isAdmin = false;
this.groupProfile = response;
// tslint:disable-next-line:max-line-length
this.groupProfile.allowedToJoinGroup = this.requestService.isAllowedToJoinGroup(this.groupProfile.id, this.self);

@ -52,12 +52,10 @@ export class Group {
const user = new User();
this.admins.push(user.assignFromResponse(admin));
}
for (const admin of this.admins) {
for (const member of this.members) {
if (member.userID === admin.userID) {
member.isGroupAdmin = true;
}
}
member.isGroupAdmin = !!this.admins.find((a: User) => {
return a.userID === member.userID;
});
}
}

@ -95,9 +95,6 @@ export class GroupService extends BaseService {
groupId
}
};
const group = this.group.getValue();
group.admins = [];
this.group.next(group);
return this.postGraphql(body, null, 0)
.pipe(tap(response => {
const group = this.group.getValue();
@ -117,9 +114,6 @@ export class GroupService extends BaseService {
groupId
}
};
const group = this.group.getValue();
group.admins = [];
this.group.next(group);
return this.postGraphql(body, null, 0)
.pipe(tap(response => {
const group = this.group.getValue();

Loading…
Cancel
Save