aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
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
parentb10ba55aca84b4513bc641f8bc7f298cc0f02a9c (diff)
downloadPeerTube-5b8072ee0ba95641da535309c6582330afb6e603.tar.gz
PeerTube-5b8072ee0ba95641da535309c6582330afb6e603.tar.zst
PeerTube-5b8072ee0ba95641da535309c6582330afb6e603.zip
Fix comment highlight
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.component.html2
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.html8
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts22
3 files changed, 16 insertions, 16 deletions
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 @@
6 6
7 <div class="comment-account-date"> 7 <div class="comment-account-date">
8 <a target="_blank" [href]="comment.account.url" class="comment-account">{{ comment.by }}</a> 8 <a target="_blank" [href]="comment.account.url" class="comment-account">{{ comment.by }}</a>
9 <a [routerLink]="['/videos/watch', video.uuid, { 'commentId': comment.id }]" class="comment-date">{{ comment.createdAt | myFromNow }}</a> 9 <a [routerLink]="['/videos/watch', video.uuid, { 'threadId': comment.threadId }]" class="comment-date">{{ comment.createdAt | myFromNow }}</a>
10 </div> 10 </div>
11 <div class="comment-html" [innerHTML]="sanitizedCommentHTML"></div> 11 <div class="comment-html" [innerHTML]="sanitizedCommentHTML"></div>
12 12
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 @@
19 [autoLoading]="true" 19 [autoLoading]="true"
20 (nearOfBottom)="onNearOfBottom()" 20 (nearOfBottom)="onNearOfBottom()"
21 > 21 >
22 <div *ngIf="highlightedComment" id="highlighted-comment"> 22 <div *ngIf="highlightedThread" id="highlighted-comment">
23 <my-video-comment 23 <my-video-comment
24 [comment]="highlightedComment" 24 [comment]="highlightedThread"
25 [video]="video" 25 [video]="video"
26 [inReplyToCommentId]="inReplyToCommentId" 26 [inReplyToCommentId]="inReplyToCommentId"
27 [commentTree]="threadComments[highlightedComment.id]" 27 [commentTree]="threadComments[highlightedThread.id]"
28 [highlightedComment]="true" 28 [highlightedComment]="true"
29 (wantedToReply)="onWantedToReply($event)" 29 (wantedToReply)="onWantedToReply($event)"
30 (wantedToDelete)="onWantedToDelete($event)" 30 (wantedToDelete)="onWantedToDelete($event)"
@@ -35,7 +35,7 @@
35 35
36 <div *ngFor="let comment of comments"> 36 <div *ngFor="let comment of comments">
37 <my-video-comment 37 <my-video-comment
38 *ngIf="!highlightedComment || comment.id !== highlightedComment.id" 38 *ngIf="!highlightedThread || comment.id !== highlightedThread.id"
39 [comment]="comment" 39 [comment]="comment"
40 [video]="video" 40 [video]="video"
41 [inReplyToCommentId]="inReplyToCommentId" 41 [inReplyToCommentId]="inReplyToCommentId"
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}