1
0
Fork 0

Fix other videos not displayed in video watch

This commit is contained in:
Chocobozzz 2018-02-07 12:20:48 +01:00
parent 588d837c87
commit 649fb0829a
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 12 additions and 4 deletions

View File

@ -70,7 +70,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
ngOnInit () { ngOnInit () {
this.videoService.getVideos({ currentPage: 1, itemsPerPage: 5 }, '-createdAt') this.videoService.getVideos({ currentPage: 1, itemsPerPage: 5 }, '-createdAt')
.subscribe( .subscribe(
data => this.otherVideos = data.videos, data => {
this.otherVideos = data.videos
this.updateOtherVideosDisplayed()
},
err => console.error(err) err => console.error(err)
) )
@ -290,9 +294,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
private onVideoFetched (video: VideoDetails) { private onVideoFetched (video: VideoDetails) {
this.video = video this.video = video
if (this.otherVideos.length > 0) { this.updateOtherVideosDisplayed()
this.otherVideosDisplayed = this.otherVideos.filter(v => v.uuid !== this.video.uuid)
}
let observable let observable
if (this.video.isVideoNSFWForUser(this.user)) { if (this.video.isVideoNSFWForUser(this.user)) {
@ -402,6 +404,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
this.video.dislikes += dislikesToIncrement this.video.dislikes += dislikesToIncrement
} }
private updateOtherVideosDisplayed () {
if (this.otherVideos.length > 0) {
this.otherVideosDisplayed = this.otherVideos.filter(v => v.uuid !== this.video.uuid)
}
}
private setOpenGraphTags () { private setOpenGraphTags () {
this.metaService.setTitle(this.video.name) this.metaService.setTitle(this.video.name)