diff options
Diffstat (limited to 'client/src/app/videos/+video-watch/comment/video-comment.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comment.component.ts | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.ts b/client/src/app/videos/+video-watch/comment/video-comment.component.ts index 38e603d0d..7c664ca60 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' |
2 | import * as sanitizeHtml from 'sanitize-html' | 2 | import * as sanitizeHtml from 'sanitize-html' |
3 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' | 3 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' |
4 | import { UserRight } from '../../../../../../shared/models/users' | 4 | import { UserRight } from '../../../../../../shared/models/users' |
@@ -13,12 +13,13 @@ import { VideoComment } from './video-comment.model' | |||
13 | templateUrl: './video-comment.component.html', | 13 | templateUrl: './video-comment.component.html', |
14 | styleUrls: ['./video-comment.component.scss'] | 14 | styleUrls: ['./video-comment.component.scss'] |
15 | }) | 15 | }) |
16 | export class VideoCommentComponent implements OnInit { | 16 | export class VideoCommentComponent implements OnInit, OnChanges { |
17 | @Input() video: Video | 17 | @Input() video: Video |
18 | @Input() comment: VideoComment | 18 | @Input() comment: VideoComment |
19 | @Input() parentComments: VideoComment[] = [] | 19 | @Input() parentComments: VideoComment[] = [] |
20 | @Input() commentTree: VideoCommentThreadTree | 20 | @Input() commentTree: VideoCommentThreadTree |
21 | @Input() inReplyToCommentId: number | 21 | @Input() inReplyToCommentId: number |
22 | @Input() highlightedComment = false | ||
22 | 23 | ||
23 | @Output() wantedToDelete = new EventEmitter<VideoComment>() | 24 | @Output() wantedToDelete = new EventEmitter<VideoComment>() |
24 | @Output() wantedToReply = new EventEmitter<VideoComment>() | 25 | @Output() wantedToReply = new EventEmitter<VideoComment>() |
@@ -35,11 +36,11 @@ export class VideoCommentComponent implements OnInit { | |||
35 | } | 36 | } |
36 | 37 | ||
37 | ngOnInit () { | 38 | ngOnInit () { |
38 | this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, { | 39 | this.init() |
39 | allowedTags: [ 'p', 'span' ] | 40 | } |
40 | }) | ||
41 | 41 | ||
42 | this.newParentComments = this.parentComments.concat([ this.comment ]) | 42 | ngOnChanges () { |
43 | this.init() | ||
43 | } | 44 | } |
44 | 45 | ||
45 | onCommentReplyCreated (createdComment: VideoComment) { | 46 | onCommentReplyCreated (createdComment: VideoComment) { |
@@ -86,4 +87,12 @@ export class VideoCommentComponent implements OnInit { | |||
86 | this.user.hasRight(UserRight.REMOVE_ANY_VIDEO_COMMENT) | 87 | this.user.hasRight(UserRight.REMOVE_ANY_VIDEO_COMMENT) |
87 | ) | 88 | ) |
88 | } | 89 | } |
90 | |||
91 | private init () { | ||
92 | this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, { | ||
93 | allowedTags: [ 'p', 'span' ] | ||
94 | }) | ||
95 | |||
96 | this.newParentComments = this.parentComments.concat([ this.comment ]) | ||
97 | } | ||
89 | } | 98 | } |