From 5b8072ee0ba95641da535309c6582330afb6e603 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 21 Feb 2018 17:46:04 +0100 Subject: Fix comment highlight --- .../comment/video-comment.component.html | 2 +- .../comment/video-comments.component.html | 8 ++++---- .../comment/video-comments.component.ts | 22 +++++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'client') diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.html b/client/src/app/videos/+video-watch/comment/video-comment.component.html index e3049e15b..831ea0521 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.html @@ -6,7 +6,7 @@
- {{ comment.createdAt | myFromNow }} + {{ comment.createdAt | myFromNow }}
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html index f95e2cbba..6f3e57160 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html @@ -19,12 +19,12 @@ [autoLoading]="true" (nearOfBottom)="onNearOfBottom()" > -
+
{ - if (params['commentId']) { - const highlightedCommentId = +params['commentId'] - this.processHighlightedComment(highlightedCommentId) + if (params['threadId']) { + const highlightedThreadId = +params['threadId'] + this.processHighlightedThread(highlightedThreadId) } } ) @@ -65,7 +65,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { if (this.sub) this.sub.unsubscribe() } - viewReplies (commentId: number, highlightComment = false) { + viewReplies (commentId: number, highlightThread = false) { this.threadLoading[commentId] = true this.videoCommentService.getVideoThreadComments(this.video.id, commentId) @@ -74,7 +74,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.threadComments[commentId] = res this.threadLoading[commentId] = false - if (highlightComment) this.highlightedComment = new VideoComment(res.comment) + if (highlightThread) this.highlightedThread = new VideoComment(res.comment) }, err => this.notificationsService.error('Error', err.message) @@ -180,7 +180,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { private resetVideo () { if (this.video.commentsEnabled === true) { // Reset all our fields - this.highlightedComment = null + this.highlightedThread = null this.comments = [] this.threadComments = {} this.threadLoading = {} @@ -192,10 +192,10 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { } } - private processHighlightedComment (highlightedCommentId: number) { - this.highlightedComment = this.comments.find(c => c.id === highlightedCommentId) + private processHighlightedThread (highlightedThreadId: number) { + this.highlightedThread = this.comments.find(c => c.id === highlightedThreadId) - const highlightComment = true - this.viewReplies(highlightedCommentId, highlightComment) + const highlightThread = true + this.viewReplies(highlightedThreadId, highlightThread) } } -- cgit v1.2.3