aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/comment/video-comments.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-21 17:46:04 +0100
committerChocobozzz <me@florianbigard.com>2018-02-21 17:50:41 +0100
commit5b8072ee0ba95641da535309c6582330afb6e603 (patch)
tree6b74445181299005705b9a9ab7f2f883c20ff493 /client/src/app/videos/+video-watch/comment/video-comments.component.ts
parentb10ba55aca84b4513bc641f8bc7f298cc0f02a9c (diff)
downloadPeerTube-5b8072ee0ba95641da535309c6582330afb6e603.tar.gz
PeerTube-5b8072ee0ba95641da535309c6582330afb6e603.tar.zst
PeerTube-5b8072ee0ba95641da535309c6582330afb6e603.zip
Fix comment highlight
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.ts22
1 files changed, 11 insertions, 11 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 aada9554d..16f1a0643 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
@@ -22,7 +22,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
22 @Input() user: User 22 @Input() user: User
23 23
24 comments: VideoComment[] = [] 24 comments: VideoComment[] = []
25 highlightedComment: VideoComment 25 highlightedThread: VideoComment
26 sort: SortField = '-createdAt' 26 sort: SortField = '-createdAt'
27 componentPagination: ComponentPagination = { 27 componentPagination: ComponentPagination = {
28 currentPage: 1, 28 currentPage: 1,
@@ -47,9 +47,9 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
47 // Find highlighted comment in params 47 // Find highlighted comment in params
48 this.sub = this.activatedRoute.params.subscribe( 48 this.sub = this.activatedRoute.params.subscribe(
49 params => { 49 params => {
50 if (params['commentId']) { 50 if (params['threadId']) {
51 const highlightedCommentId = +params['commentId'] 51 const highlightedThreadId = +params['threadId']
52 this.processHighlightedComment(highlightedCommentId) 52 this.processHighlightedThread(highlightedThreadId)
53 } 53 }
54 } 54 }
55 ) 55 )
@@ -65,7 +65,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
65 if (this.sub) this.sub.unsubscribe() 65 if (this.sub) this.sub.unsubscribe()
66 } 66 }
67 67
68 viewReplies (commentId: number, highlightComment = false) { 68 viewReplies (commentId: number, highlightThread = false) {
69 this.threadLoading[commentId] = true 69 this.threadLoading[commentId] = true
70 70
71 this.videoCommentService.getVideoThreadComments(this.video.id, commentId) 71 this.videoCommentService.getVideoThreadComments(this.video.id, commentId)
@@ -74,7 +74,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
74 this.threadComments[commentId] = res 74 this.threadComments[commentId] = res
75 this.threadLoading[commentId] = false 75 this.threadLoading[commentId] = false
76 76
77 if (highlightComment) this.highlightedComment = new VideoComment(res.comment) 77 if (highlightThread) this.highlightedThread = new VideoComment(res.comment)
78 }, 78 },
79 79
80 err => this.notificationsService.error('Error', err.message) 80 err => this.notificationsService.error('Error', err.message)
@@ -180,7 +180,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
180 private resetVideo () { 180 private resetVideo () {
181 if (this.video.commentsEnabled === true) { 181 if (this.video.commentsEnabled === true) {
182 // Reset all our fields 182 // Reset all our fields
183 this.highlightedComment = null 183 this.highlightedThread = null
184 this.comments = [] 184 this.comments = []
185 this.threadComments = {} 185 this.threadComments = {}
186 this.threadLoading = {} 186 this.threadLoading = {}
@@ -192,10 +192,10 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
192 } 192 }
193 } 193 }
194 194
195 private processHighlightedComment (highlightedCommentId: number) { 195 private processHighlightedThread (highlightedThreadId: number) {
196 this.highlightedComment = this.comments.find(c => c.id === highlightedCommentId) 196 this.highlightedThread = this.comments.find(c => c.id === highlightedThreadId)
197 197
198 const highlightComment = true 198 const highlightThread = true
199 this.viewReplies(highlightedCommentId, highlightComment) 199 this.viewReplies(highlightedThreadId, highlightThread)
200 } 200 }
201} 201}