aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-20 10:41:11 +0100
committerChocobozzz <me@florianbigard.com>2018-02-20 10:41:11 +0100
commit5de8a55abce53108bc1024f1194457c6528bd11e (patch)
tree24d55c349807581a86872490753c2e1bddff932d /client/src/app/videos/+video-watch
parent2f315e2f915514eaddee30394b0d99790bcda06b (diff)
downloadPeerTube-5de8a55abce53108bc1024f1194457c6528bd11e.tar.gz
PeerTube-5de8a55abce53108bc1024f1194457c6528bd11e.tar.zst
PeerTube-5de8a55abce53108bc1024f1194457c6528bd11e.zip
Handle line feeds in comments
Diffstat (limited to 'client/src/app/videos/+video-watch')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.ts2
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.service.ts7
2 files changed, 6 insertions, 3 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 7c664ca60..9176de80f 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
@@ -90,7 +90,7 @@ export class VideoCommentComponent implements OnInit, OnChanges {
90 90
91 private init () { 91 private init () {
92 this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, { 92 this.sanitizedCommentHTML = sanitizeHtml(this.comment.text, {
93 allowedTags: [ 'p', 'span' ] 93 allowedTags: [ 'p', 'span', 'br' ]
94 }) 94 })
95 95
96 this.newParentComments = this.parentComments.concat([ this.comment ]) 96 this.newParentComments = this.parentComments.concat([ this.comment ])
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 c42f55496..14d32b1aa 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
@@ -2,6 +2,7 @@ import { HttpClient, HttpParams } from '@angular/common/http'
2import { Injectable } from '@angular/core' 2import { Injectable } from '@angular/core'
3import 'rxjs/add/operator/catch' 3import 'rxjs/add/operator/catch'
4import 'rxjs/add/operator/map' 4import 'rxjs/add/operator/map'
5import { immutableAssign, lineFeedToHtml } from '@app/shared/misc/utils'
5import { Observable } from 'rxjs/Observable' 6import { Observable } from 'rxjs/Observable'
6import { ResultList } from '../../../../../../shared/models' 7import { ResultList } from '../../../../../../shared/models'
7import { 8import {
@@ -26,16 +27,18 @@ export class VideoCommentService {
26 27
27 addCommentThread (videoId: number | string, comment: VideoCommentCreate) { 28 addCommentThread (videoId: number | string, comment: VideoCommentCreate) {
28 const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' 29 const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads'
30 const normalizedComment = lineFeedToHtml(comment, 'text')
29 31
30 return this.authHttp.post(url, comment) 32 return this.authHttp.post(url, normalizedComment)
31 .map(data => this.extractVideoComment(data['comment'])) 33 .map(data => this.extractVideoComment(data['comment']))
32 .catch(this.restExtractor.handleError) 34 .catch(this.restExtractor.handleError)
33 } 35 }
34 36
35 addCommentReply (videoId: number | string, inReplyToCommentId: number, comment: VideoCommentCreate) { 37 addCommentReply (videoId: number | string, inReplyToCommentId: number, comment: VideoCommentCreate) {
36 const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId 38 const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId
39 const normalizedComment = lineFeedToHtml(comment, 'text')
37 40
38 return this.authHttp.post(url, comment) 41 return this.authHttp.post(url, normalizedComment)
39 .map(data => this.extractVideoComment(data['comment'])) 42 .map(data => this.extractVideoComment(data['comment']))
40 .catch(this.restExtractor.handleError) 43 .catch(this.restExtractor.handleError)
41 } 44 }