diff options
Diffstat (limited to 'client/src/app/videos')
3 files changed, 20 insertions, 3 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.html b/client/src/app/videos/+video-watch/comment/video-comment.component.html index 4f9597607..8edd12124 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.html | |||
@@ -6,7 +6,7 @@ | |||
6 | <a target="_blank" [href]="comment.account.url" class="comment-account">{{ comment.by }}</a> | 6 | <a target="_blank" [href]="comment.account.url" class="comment-account">{{ comment.by }}</a> |
7 | <div class="comment-date">{{ comment.createdAt | myFromNow }}</div> | 7 | <div class="comment-date">{{ comment.createdAt | myFromNow }}</div> |
8 | </div> | 8 | </div> |
9 | <div>{{ comment.text }}</div> | 9 | <div class="comment-html" [innerHTML]="sanitizedCommentHTML"></div> |
10 | 10 | ||
11 | <div class="comment-actions"> | 11 | <div class="comment-actions"> |
12 | <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply">Reply</div> | 12 | <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply">Reply</div> |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.scss b/client/src/app/videos/+video-watch/comment/video-comment.component.scss index a22c5a9fd..8e53dbca8 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.scss +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.scss | |||
@@ -32,6 +32,14 @@ | |||
32 | } | 32 | } |
33 | } | 33 | } |
34 | 34 | ||
35 | .comment-html { | ||
36 | a { | ||
37 | @include disable-default-a-behaviour; | ||
38 | |||
39 | color: #000; | ||
40 | } | ||
41 | } | ||
42 | |||
35 | .comment-actions { | 43 | .comment-actions { |
36 | margin: 10px 0; | 44 | margin: 10px 0; |
37 | display: flex; | 45 | display: flex; |
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 9bc9c8844..2ecc8a143 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,5 @@ | |||
1 | import { Component, EventEmitter, Input, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' |
2 | import * as sanitizeHtml from 'sanitize-html' | ||
2 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' | 3 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' |
3 | import { UserRight } from '../../../../../../shared/models/users' | 4 | import { UserRight } from '../../../../../../shared/models/users' |
4 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' | 5 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' |
@@ -12,7 +13,7 @@ import { VideoComment } from './video-comment.model' | |||
12 | templateUrl: './video-comment.component.html', | 13 | templateUrl: './video-comment.component.html', |
13 | styleUrls: ['./video-comment.component.scss'] | 14 | styleUrls: ['./video-comment.component.scss'] |
14 | }) | 15 | }) |
15 | export class VideoCommentComponent { | 16 | export class VideoCommentComponent implements OnInit { |
16 | @Input() video: Video | 17 | @Input() video: Video |
17 | @Input() comment: VideoComment | 18 | @Input() comment: VideoComment |
18 | @Input() commentTree: VideoCommentThreadTree | 19 | @Input() commentTree: VideoCommentThreadTree |
@@ -23,12 +24,20 @@ export class VideoCommentComponent { | |||
23 | @Output() threadCreated = new EventEmitter<VideoCommentThreadTree>() | 24 | @Output() threadCreated = new EventEmitter<VideoCommentThreadTree>() |
24 | @Output() resetReply = new EventEmitter() | 25 | @Output() resetReply = new EventEmitter() |
25 | 26 | ||
27 | sanitizedCommentHTML = '' | ||
28 | |||
26 | constructor (private authService: AuthService) {} | 29 | constructor (private authService: AuthService) {} |
27 | 30 | ||
28 | get user () { | 31 | get user () { |
29 | return this.authService.getUser() | 32 | return this.authService.getUser() |
30 | } | 33 | } |
31 | 34 | ||
35 | ngOnInit () { | ||
36 | this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, { | ||
37 | allowedTags: [ 'p', 'span' ] | ||
38 | }) | ||
39 | } | ||
40 | |||
32 | onCommentReplyCreated (createdComment: VideoComment) { | 41 | onCommentReplyCreated (createdComment: VideoComment) { |
33 | if (!this.commentTree) { | 42 | if (!this.commentTree) { |
34 | this.commentTree = { | 43 | this.commentTree = { |