diff --git a/src/app/components/adminpage/adminpage.component.ts b/src/app/components/adminpage/adminpage.component.ts index 11b046e..f1e9b91 100644 --- a/src/app/components/adminpage/adminpage.component.ts +++ b/src/app/components/adminpage/adminpage.component.ts @@ -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'; diff --git a/src/app/components/group/group.component.html b/src/app/components/group/group.component.html index 5b80133..132e5b1 100644 --- a/src/app/components/group/group.component.html +++ b/src/app/components/group/group.component.html @@ -134,7 +134,7 @@ {{user.username}} {{user.handle}} - [admin] + [admin] diff --git a/src/app/components/group/group.component.ts b/src/app/components/group/group.component.ts index e639a62..48c2eb8 100644 --- a/src/app/components/group/group.component.ts +++ b/src/app/components/group/group.component.ts @@ -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); diff --git a/src/app/models/group.ts b/src/app/models/group.ts index 4d67937..0f6ecdf 100644 --- a/src/app/models/group.ts +++ b/src/app/models/group.ts @@ -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; - } - } + for (const member of this.members) { + member.isGroupAdmin = !!this.admins.find((a: User) => { + return a.userID === member.userID; + }); } } diff --git a/src/app/services/group/group.service.ts b/src/app/services/group/group.service.ts index 0b427a0..4bd344e 100644 --- a/src/app/services/group/group.service.ts +++ b/src/app/services/group/group.service.ts @@ -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();