diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts index acb0137a08a3993db91ce1d531533a3f536a2d52..768371bf740d8c98d3e7b4ed3fd4f2b7dbf74970 100644 --- a/src/app/components/shared/comment/comment.component.ts +++ b/src/app/components/shared/comment/comment.component.ts @@ -18,6 +18,7 @@ import { UserRole } from '../../../models/user-roles.enum'; import { Rescale } from '../../../models/rescale'; import { RowComponent } from '../../../../../projects/ars/src/lib/components/layout/frame/row/row.component'; import { User } from '../../../models/user'; +import { Observable } from 'rxjs'; @Component({ selector: 'app-comment', @@ -40,7 +41,9 @@ export class CommentComponent implements OnInit, AfterViewInit { @Input() moderator: boolean; @Input() userRole: UserRole; @Input() user: User; + @Input() disabled = false; @Output() clickedOnTag = new EventEmitter<string>(); + @Output() clickedOnKeyword = new EventEmitter<string>(); @Output() clickedUserNumber = new EventEmitter<number>(); isStudent = false; isCreator = false; @@ -57,6 +60,7 @@ export class CommentComponent implements OnInit, AfterViewInit { @ViewChild('commentExpander', { static: true })commentExpander: RowComponent; isExpanded = false; isExpandable = false; + selectedKeyword: string = ''; constructor(protected authenticationService: AuthenticationService, private route: ActivatedRoute, @@ -127,7 +131,10 @@ export class CommentComponent implements OnInit, AfterViewInit { } setRead(comment: Comment): void { - this.commentService.toggleRead(comment).subscribe(); + // @ts-ignore + + this.commentService.toggleRead(comment).subscribe(c => {this.comment = c; this.comment.keywordsFromQuestioner = JSON.parse(c.keywordsFromQuestioner)}); + // @ts-ignore } markCorrect(comment: Comment, type: CorrectWrong): void { @@ -136,11 +143,16 @@ export class CommentComponent implements OnInit, AfterViewInit { } else { comment.correct = type; } - this.commentService.markCorrect(comment).subscribe(); + // @ts-ignore + this.commentService.markCorrect(comment).subscribe(c => {this.comment = c; this.comment.keywordsFromQuestioner = JSON.parse(c.keywordsFromQuestioner)}); + // @ts-ignore } + setFavorite(comment: Comment): void { - this.commentService.toggleFavorite(comment).subscribe(); + // @ts-ignore + this.commentService.toggleFavorite(comment).subscribe(c => {this.comment = c; this.comment.keywordsFromQuestioner = JSON.parse(c.keywordsFromQuestioner)}); + // @ts-ignore } voteUp(comment: Comment): void { @@ -207,11 +219,15 @@ export class CommentComponent implements OnInit, AfterViewInit { } setAck(comment: Comment): void { - this.commentService.toggleAck(comment).subscribe(); + //@ts-ignore + this.commentService.toggleAck(comment).subscribe(c => {this.comment = c; this.comment.keywordsFromQuestioner = JSON.parse(c.keywordsFromQuestioner)}); + //@ts-ignore } setBookmark(comment: Comment): void { - this.commentService.toggleBookmark(comment).subscribe(); + //@ts-ignore + this.commentService.toggleBookmark(comment).subscribe(c => {this.comment = c; this.comment.keywordsFromQuestioner = JSON.parse(c.keywordsFromQuestioner)}); + //@ts-ignore } goToFullScreen(element: Element): void {