From 649fb0829a0735eae9938cdedd8573b5f4bc5100 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 7 Feb 2018 12:20:48 +0100 Subject: Fix other videos not displayed in video watch --- .../src/app/videos/+video-watch/video-watch.component.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'client') 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 c9bdd4dfc..a281fff23 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -70,7 +70,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy { ngOnInit () { this.videoService.getVideos({ currentPage: 1, itemsPerPage: 5 }, '-createdAt') .subscribe( - data => this.otherVideos = data.videos, + data => { + this.otherVideos = data.videos + this.updateOtherVideosDisplayed() + }, + err => console.error(err) ) @@ -290,9 +294,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { private onVideoFetched (video: VideoDetails) { this.video = video - if (this.otherVideos.length > 0) { - this.otherVideosDisplayed = this.otherVideos.filter(v => v.uuid !== this.video.uuid) - } + this.updateOtherVideosDisplayed() let observable if (this.video.isVideoNSFWForUser(this.user)) { @@ -402,6 +404,12 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.video.dislikes += dislikesToIncrement } + private updateOtherVideosDisplayed () { + if (this.otherVideos.length > 0) { + this.otherVideosDisplayed = this.otherVideos.filter(v => v.uuid !== this.video.uuid) + } + } + private setOpenGraphTags () { this.metaService.setTitle(this.video.name) -- cgit v1.2.3