X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bvideos%2F%2Bvideo-watch%2Fcomment%2Fvideo-comments.component.ts;h=210236b61133856fe23f56afdb8737f75a484b47;hb=fa12eacc014aae8094d108634371640f2695bf9f;hp=79627b1af1bc82e4bb642614daf74f9813bbd5d7;hpb=93e903ac165eed918986e415127d6ea9730e572c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts index 79627b1af..210236b61 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts @@ -20,15 +20,20 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { comments: VideoComment[] = [] highlightedThread: VideoComment + sort = '-createdAt' + componentPagination: ComponentPagination = { currentPage: 1, itemsPerPage: 10, totalItems: null } + totalNotDeletedComments: number + inReplyToCommentId: number commentReplyRedraftValue: string commentThreadRedraftValue: string + threadComments: { [ id: number ]: VideoCommentThreadTree } = {} threadLoading: { [ id: number ]: boolean } = {} @@ -122,6 +127,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { res => { this.comments = this.comments.concat(res.data) this.componentPagination.totalItems = res.total + this.totalNotDeletedComments = res.totalNotDeletedComments this.onDataSubject.next(res.data) this.hooks.runAction('action:video-watch.video-threads.loaded', 'video-watch', { data: this.componentPagination }) @@ -199,10 +205,13 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { if (confirm) { this.inReplyToCommentId = commentToRedraft.inReplyToCommentId + // Restore line feed for editing + const commentToRedraftText = commentToRedraft.text.replace(//g, '\r\n') + if (commentToRedraft.threadId === commentToRedraft.id) { - this.commentThreadRedraftValue = commentToRedraft.text + this.commentThreadRedraftValue = commentToRedraftText } else { - this.commentReplyRedraftValue = commentToRedraft.text + this.commentReplyRedraftValue = commentToRedraftText } } @@ -236,6 +245,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.inReplyToCommentId = undefined this.componentPagination.currentPage = 1 this.componentPagination.totalItems = null + this.totalNotDeletedComments = null this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video.uuid) this.loadMoreThreads()