From 9d6b9d10ef8cbef39e89bc709285abffb0d8caa1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 19 Feb 2021 09:50:13 +0100 Subject: Fix video comments display with deleted comments --- .../+videos/+video-watch/comment/video-comments.component.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'client/src/app/+videos/+video-watch/comment/video-comments.component.ts') 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 f83a73ccd..d36dd9e34 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 @@ -21,15 +21,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,8 +127,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { obs.subscribe( res => { this.comments = this.comments.concat(res.data) - // Client does not display removed comments - this.componentPagination.totalItems = res.total - this.comments.filter(c => c.isDeleted).length + 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 }) @@ -241,6 +246,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() -- cgit v1.2.3