aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-12 17:16:48 +0100
committerChocobozzz <me@florianbigard.com>2018-01-12 17:17:45 +0100
commit339632b4a3f94a6ebee3767054ef6c701858a785 (patch)
treee71fe304d9b4b732609724ee2402be97843d2332 /client/src/app
parent0af3182bf77aac7fc0a122d559ccb1941e75db23 (diff)
downloadPeerTube-339632b4a3f94a6ebee3767054ef6c701858a785.tar.gz
PeerTube-339632b4a3f94a6ebee3767054ef6c701858a785.tar.zst
PeerTube-339632b4a3f94a6ebee3767054ef6c701858a785.zip
Fix changing video in watch page
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts27
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts2
2 files changed, 23 insertions, 6 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 030dee9af..6025256de 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
@@ -1,4 +1,4 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'
2import { ConfirmService } from '@app/core' 2import { ConfirmService } from '@app/core'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { VideoComment as VideoCommentInterface, VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' 4import { VideoComment as VideoCommentInterface, VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model'
@@ -15,7 +15,7 @@ import { VideoCommentService } from './video-comment.service'
15 templateUrl: './video-comments.component.html', 15 templateUrl: './video-comments.component.html',
16 styleUrls: ['./video-comments.component.scss'] 16 styleUrls: ['./video-comments.component.scss']
17}) 17})
18export class VideoCommentsComponent implements OnInit { 18export class VideoCommentsComponent implements OnChanges {
19 @Input() video: VideoDetails 19 @Input() video: VideoDetails
20 @Input() user: User 20 @Input() user: User
21 21
@@ -37,9 +37,9 @@ export class VideoCommentsComponent implements OnInit {
37 private videoCommentService: VideoCommentService 37 private videoCommentService: VideoCommentService
38 ) {} 38 ) {}
39 39
40 ngOnInit () { 40 ngOnChanges (changes: SimpleChanges) {
41 if (this.video.commentsEnabled === true) { 41 if (changes['video']) {
42 this.loadMoreComments() 42 this.loadVideoComments()
43 } 43 }
44 } 44 }
45 45
@@ -152,4 +152,21 @@ export class VideoCommentsComponent implements OnInit {
152 this.deleteLocalCommentThread(commentChild, commentToDelete) 152 this.deleteLocalCommentThread(commentChild, commentToDelete)
153 } 153 }
154 } 154 }
155
156 private loadVideoComments () {
157 if (this.video.commentsEnabled === true) {
158 // Reset all our fields
159 this.comments = []
160 this.threadComments = {}
161 this.threadLoading = {}
162 this.inReplyToCommentId = undefined
163 this.componentPagination = {
164 currentPage: 1,
165 itemsPerPage: 10,
166 totalItems: null
167 }
168
169 this.loadMoreComments()
170 }
171 }
155} 172}
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts
index 1c2317c52..c9bdd4dfc 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -347,7 +347,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
347 }) 347 })
348 }) 348 })
349 } else { 349 } else {
350 (this.player as any).setVideoFiles(this.video.files) 350 this.player.peertube().setVideoFiles(this.video.files)
351 } 351 }
352 352
353 this.setVideoDescriptionHTML() 353 this.setVideoDescriptionHTML()