diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts index 5c2015db9409c53e645c47976eaea3105cb62faa..fc6f5f3e5636ccc30c1343588f292ec7604d73af 100644 --- a/src/app/components/shared/comment-list/comment-list.component.ts +++ b/src/app/components/shared/comment-list/comment-list.component.ts @@ -57,11 +57,6 @@ export class CommentListComponent implements OnInit { ngOnInit() { this.roomId = localStorage.getItem(`roomId`); const userId = this.authenticationService.getUser().id; - this.voteService.getByRoomIdAndUserID(this.roomId, userId).subscribe(votes => { - for (const v of votes) { - this.commentVoteMap.set(v.commentId, v); - } - }); this.roomService.getRoom(this.roomId).subscribe( room => this.room = room); this.hideCommentsList = false; this.wsCommentService.getCommentStream(this.roomId).subscribe((message: Message) => { @@ -70,6 +65,13 @@ export class CommentListComponent implements OnInit { this.translateService.use(localStorage.getItem('currentLang')); this.userRole = this.authenticationService.getRole(); this.deviceType = localStorage.getItem('deviceType'); + if (this.userRole === 0) { + this.voteService.getByRoomIdAndUserID(this.roomId, userId).subscribe(votes => { + for (const v of votes) { + this.commentVoteMap.set(v.commentId, v); + } + }); + } this.getComments(); } @@ -97,7 +99,9 @@ export class CommentListComponent implements OnInit { } getVote(comment: Comment): Vote { - return this.commentVoteMap.get(comment.id); + if (this.userRole === 0) { + return this.commentVoteMap.get(comment.id); + } } parseIncomingMessage(message: Message) { diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts index 9590065316ab51fe13eed174bae56529d1352fa3..d7f60c701ffdfa59a2d9aa3c4369fc06a63c1d86 100644 --- a/src/app/components/shared/comment/comment.component.ts +++ b/src/app/components/shared/comment/comment.component.ts @@ -77,7 +77,9 @@ export class CommentComponent implements OnInit { @Input() set parseVote(vote: Vote) { - this.hasVoted = vote.vote; + if (this.isStudent) { + this.hasVoted = vote.vote; + } } resetAnimationState(): void {