diff --git a/src/app/comment-list/comment-list.component.ts b/src/app/comment-list/comment-list.component.ts index b942f10370cb9f3b354f163b58b8404b3089d2dc..0a015a2b0a3da0f3fe242a85d93c0cfd36b4c43d 100644 --- a/src/app/comment-list/comment-list.component.ts +++ b/src/app/comment-list/comment-list.component.ts @@ -27,7 +27,8 @@ export class CommentListComponent implements OnInit { private roomService: RoomService, private location: Location, private commentService: CommentService, - private notification: NotificationService) { } + private notification: NotificationService) { + } ngOnInit() { this.userRole = this.authenticationService.getRole(); @@ -47,16 +48,21 @@ export class CommentListComponent implements OnInit { getComments(roomId: string): void { if (this.userRole === UserRole.CREATOR) { this.commentService.getComments(roomId) - .subscribe(comments => this.comments = comments); + .subscribe(comments => { + this.comments = comments; + this.isLoading = false; + }); } else if (this.userRole === UserRole.PARTICIPANT) { this.commentService.searchComments(roomId, this.user.id) - .subscribe(comments => this.comments = comments); + .subscribe(comments => { + this.comments = comments; + this.isLoading = false; + }); } - this.isLoading = false; } setRead(comment: Comment): void { - this.comments.find( c => c.id === comment.id).read = !comment.read; + this.comments.find(c => c.id === comment.id).read = !comment.read; this.commentService.updateComment(comment).subscribe(); }