From: Chocobozzz Date: Wed, 21 Feb 2018 16:46:04 +0000 (+0100) Subject: Fix comment highlight X-Git-Tag: v0.0.27-alpha~22 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=5b8072ee0ba95641da535309c6582330afb6e603;hp=b10ba55aca84b4513bc641f8bc7f298cc0f02a9c;p=github%2FChocobozzz%2FPeerTube.git Fix comment highlight --- 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) } }