diff options
Diffstat (limited to 'client/src/app/videos/+video-watch')
3 files changed, 15 insertions, 5 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts index 9e499d829..183cde000 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | |||
@@ -2,7 +2,7 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } | |||
2 | import { FormBuilder, FormGroup } from '@angular/forms' | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { Observable } from 'rxjs/Observable' | 4 | import { Observable } from 'rxjs/Observable' |
5 | import { VideoCommentCreate, VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' | 5 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' |
6 | import { FormReactive } from '../../../shared' | 6 | import { FormReactive } from '../../../shared' |
7 | import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment' | 7 | import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment' |
8 | import { User } from '../../../shared/users' | 8 | import { User } from '../../../shared/users' |
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 9176de80f..0224132ac 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, OnChanges, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core' |
2 | import { MarkdownService } from '@app/videos/shared' | ||
2 | import * as sanitizeHtml from 'sanitize-html' | 3 | import * as sanitizeHtml from 'sanitize-html' |
3 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' | 4 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' |
4 | import { UserRight } from '../../../../../../shared/models/users' | 5 | import { UserRight } from '../../../../../../shared/models/users' |
@@ -29,7 +30,10 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
29 | sanitizedCommentHTML = '' | 30 | sanitizedCommentHTML = '' |
30 | newParentComments = [] | 31 | newParentComments = [] |
31 | 32 | ||
32 | constructor (private authService: AuthService) {} | 33 | constructor ( |
34 | private authService: AuthService, | ||
35 | private markdownService: MarkdownService | ||
36 | ) {} | ||
33 | 37 | ||
34 | get user () { | 38 | get user () { |
35 | return this.authService.getUser() | 39 | return this.authService.getUser() |
@@ -90,9 +94,13 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
90 | 94 | ||
91 | private init () { | 95 | private init () { |
92 | this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, { | 96 | this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, { |
93 | allowedTags: [ 'p', 'span', 'br' ] | 97 | allowedTags: [ 'a', 'p', 'span', 'br' ], |
98 | allowedSchemes: [ 'http', 'https' ] | ||
94 | }) | 99 | }) |
95 | 100 | ||
101 | // Convert possible markdown to html | ||
102 | this.sanitizedCommentHTML = this.markdownService.linkify(this.comment.text) | ||
103 | |||
96 | this.newParentComments = this.parentComments.concat([ this.comment ]) | 104 | this.newParentComments = this.parentComments.concat([ this.comment ]) |
97 | } | 105 | } |
98 | } | 106 | } |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts index 14d32b1aa..470af1230 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts | |||
@@ -1,12 +1,14 @@ | |||
1 | import { HttpClient, HttpParams } from '@angular/common/http' | 1 | import { HttpClient, HttpParams } from '@angular/common/http' |
2 | import { Injectable } from '@angular/core' | 2 | import { Injectable } from '@angular/core' |
3 | import { lineFeedToHtml } from '@app/shared/misc/utils' | ||
4 | import { MarkdownService } from '@app/videos/shared' | ||
3 | import 'rxjs/add/operator/catch' | 5 | import 'rxjs/add/operator/catch' |
4 | import 'rxjs/add/operator/map' | 6 | import 'rxjs/add/operator/map' |
5 | import { immutableAssign, lineFeedToHtml } from '@app/shared/misc/utils' | ||
6 | import { Observable } from 'rxjs/Observable' | 7 | import { Observable } from 'rxjs/Observable' |
7 | import { ResultList } from '../../../../../../shared/models' | 8 | import { ResultList } from '../../../../../../shared/models' |
8 | import { | 9 | import { |
9 | VideoComment as VideoCommentServerModel, VideoCommentCreate, | 10 | VideoComment as VideoCommentServerModel, |
11 | VideoCommentCreate, | ||
10 | VideoCommentThreadTree | 12 | VideoCommentThreadTree |
11 | } from '../../../../../../shared/models/videos/video-comment.model' | 13 | } from '../../../../../../shared/models/videos/video-comment.model' |
12 | import { environment } from '../../../../environments/environment' | 14 | import { environment } from '../../../../environments/environment' |