aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-watch/comment/video-comments.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-19 09:50:13 +0100
committerChocobozzz <me@florianbigard.com>2021-02-19 10:06:52 +0100
commit9d6b9d10ef8cbef39e89bc709285abffb0d8caa1 (patch)
tree3425b22556e00d1b15de15c72b2802cfc9374473 /client/src/app/+videos/+video-watch/comment/video-comments.component.ts
parentfae6e4da8f516a9d6c3bad9bf6f35811ccacbad8 (diff)
downloadPeerTube-9d6b9d10ef8cbef39e89bc709285abffb0d8caa1.tar.gz
PeerTube-9d6b9d10ef8cbef39e89bc709285abffb0d8caa1.tar.zst
PeerTube-9d6b9d10ef8cbef39e89bc709285abffb0d8caa1.zip
Fix video comments display with deleted comments
Diffstat (limited to 'client/src/app/+videos/+video-watch/comment/video-comments.component.ts')
-rw-r--r--client/src/app/+videos/+video-watch/comment/video-comments.component.ts10
1 files changed, 8 insertions, 2 deletions
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 {
21 21
22 comments: VideoComment[] = [] 22 comments: VideoComment[] = []
23 highlightedThread: VideoComment 23 highlightedThread: VideoComment
24
24 sort = '-createdAt' 25 sort = '-createdAt'
26
25 componentPagination: ComponentPagination = { 27 componentPagination: ComponentPagination = {
26 currentPage: 1, 28 currentPage: 1,
27 itemsPerPage: 10, 29 itemsPerPage: 10,
28 totalItems: null 30 totalItems: null
29 } 31 }
32 totalNotDeletedComments: number
33
30 inReplyToCommentId: number 34 inReplyToCommentId: number
31 commentReplyRedraftValue: string 35 commentReplyRedraftValue: string
32 commentThreadRedraftValue: string 36 commentThreadRedraftValue: string
37
33 threadComments: { [ id: number ]: VideoCommentThreadTree } = {} 38 threadComments: { [ id: number ]: VideoCommentThreadTree } = {}
34 threadLoading: { [ id: number ]: boolean } = {} 39 threadLoading: { [ id: number ]: boolean } = {}
35 40
@@ -122,8 +127,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
122 obs.subscribe( 127 obs.subscribe(
123 res => { 128 res => {
124 this.comments = this.comments.concat(res.data) 129 this.comments = this.comments.concat(res.data)
125 // Client does not display removed comments 130 this.componentPagination.totalItems = res.total
126 this.componentPagination.totalItems = res.total - this.comments.filter(c => c.isDeleted).length 131 this.totalNotDeletedComments = res.totalNotDeletedComments
127 132
128 this.onDataSubject.next(res.data) 133 this.onDataSubject.next(res.data)
129 this.hooks.runAction('action:video-watch.video-threads.loaded', 'video-watch', { data: this.componentPagination }) 134 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 {
241 this.inReplyToCommentId = undefined 246 this.inReplyToCommentId = undefined
242 this.componentPagination.currentPage = 1 247 this.componentPagination.currentPage = 1
243 this.componentPagination.totalItems = null 248 this.componentPagination.totalItems = null
249 this.totalNotDeletedComments = null
244 250
245 this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video.uuid) 251 this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video.uuid)
246 this.loadMoreThreads() 252 this.loadMoreThreads()