Merge branch 'max_dev' of Software_Engineering_I/greenvironment-frontend into master

master
Max_ES 4 years ago committed by Gitea
commit 742e9196bf

@ -106,14 +106,32 @@ export class GroupComponent implements OnInit {
ngOnInit() {
this.loading = true;
this.id = this.router.url.substr(this.router.url.lastIndexOf('/') + 1);
this.loading = true;
this.data.currentUser.subscribe(user => {
this.self = user;
this.checkSelfStats();
});
this.groupService.getGroupData(this.id).subscribe();
this.groupService.group.subscribe(response => {
if (response) {
this.isAdmin = false;
if (response.id) {
if(response.id.toString() === this.id){
this.loading = false;
}
}
this.groupProfile = response;
this.checkSelfStats();
for (const member of this.groupProfile.members) {
member.allowedToSendRequest = this.requestService.isAllowedToSendRequest(member.userID, this.self);
}
} else {
this.groupNotFound = true;
}
});
}
checkSelfStats() {
this.isAdmin = false;
// tslint:disable-next-line:max-line-length
this.groupProfile.allowedToJoinGroup = this.requestService.isAllowedToJoinGroup(this.groupProfile.id, this.self);
for (const admin of this.groupProfile.admins) {
@ -126,14 +144,6 @@ export class GroupComponent implements OnInit {
} else {
this.isCreator = false;
}
for (const member of this.groupProfile.members) {
member.allowedToSendRequest = this.requestService.isAllowedToSendRequest(member.userID, this.self);
}
} else {
this.groupNotFound = true;
}
this.loading = false;
});
}
openDialog(): void {

Loading…
Cancel
Save