aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorBrad Johnson <bradsk88@gmail.com>2018-08-31 09:19:21 -0600
committerChocobozzz <me@florianbigard.com>2018-08-31 17:19:21 +0200
commit7f5f4152a4cd4fc328d6ae177d281ebe7e792dd3 (patch)
treefd0401bd9c43e1adbbedbd2042c93bd4fef46632 /client/src/app/videos/+video-watch/video-watch.component.ts
parent1a4710914432b44115b185cec1883fdf409aef1d (diff)
downloadPeerTube-7f5f4152a4cd4fc328d6ae177d281ebe7e792dd3.tar.gz
PeerTube-7f5f4152a4cd4fc328d6ae177d281ebe7e792dd3.tar.zst
PeerTube-7f5f4152a4cd4fc328d6ae177d281ebe7e792dd3.zip
Refactor: Separated "Other Videos" section into a dedicated component/service (#969)
* Separated "Other Videos" section into a dedicated component/service I'm currently working on some proof-of-concepts for recommendation providers that could work with PeerTube to provide useful video suggestions to the user. As a first step, I want to have great clarity about how PeerTube, itself, will surface these videos to the user. With this branch, I'm refactoring the "recommendations" to make it easier to swap out different recommender implementations quickly. Stop recommender from including the video that's being watched. Ensure always 5 recommendations * Treat recommendations as a stream of values, rather than a single async value. * Prioritize readability over HTTP response size early-optimization. * Simplify pipe
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts22
1 files changed, 0 insertions, 22 deletions
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 d838ebe79..25643cfde 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -15,7 +15,6 @@ import '../../../assets/player/peertube-videojs-plugin'
15import { AuthService, ConfirmService } from '../../core' 15import { AuthService, ConfirmService } from '../../core'
16import { RestExtractor, VideoBlacklistService } from '../../shared' 16import { RestExtractor, VideoBlacklistService } from '../../shared'
17import { VideoDetails } from '../../shared/video/video-details.model' 17import { VideoDetails } from '../../shared/video/video-details.model'
18import { Video } from '../../shared/video/video.model'
19import { VideoService } from '../../shared/video/video.service' 18import { VideoService } from '../../shared/video/video.service'
20import { MarkdownService } from '../shared' 19import { MarkdownService } from '../shared'
21import { VideoDownloadComponent } from './modal/video-download.component' 20import { VideoDownloadComponent } from './modal/video-download.component'
@@ -43,8 +42,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
43 @ViewChild('videoSupportModal') videoSupportModal: VideoSupportComponent 42 @ViewChild('videoSupportModal') videoSupportModal: VideoSupportComponent
44 @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent 43 @ViewChild('videoBlacklistModal') videoBlacklistModal: VideoBlacklistComponent
45 44
46 otherVideosDisplayed: Video[] = []
47
48 player: videojs.Player 45 player: videojs.Player
49 playerElement: HTMLVideoElement 46 playerElement: HTMLVideoElement
50 userRating: UserVideoRateType = null 47 userRating: UserVideoRateType = null
@@ -60,7 +57,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
60 remoteServerDown = false 57 remoteServerDown = false
61 58
62 private videojsLocaleLoaded = false 59 private videojsLocaleLoaded = false
63 private otherVideos: Video[] = []
64 private paramsSub: Subscription 60 private paramsSub: Subscription
65 61
66 constructor ( 62 constructor (
@@ -96,16 +92,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
96 this.hasAlreadyAcceptedPrivacyConcern = true 92 this.hasAlreadyAcceptedPrivacyConcern = true
97 } 93 }
98 94
99 this.videoService.getVideos({ currentPage: 1, itemsPerPage: 5 }, '-createdAt')
100 .subscribe(
101 data => {
102 this.otherVideos = data.videos
103 this.updateOtherVideosDisplayed()
104 },
105
106 err => console.error(err)
107 )
108
109 this.paramsSub = this.route.params.subscribe(routeParams => { 95 this.paramsSub = this.route.params.subscribe(routeParams => {
110 const uuid = routeParams[ 'uuid' ] 96 const uuid = routeParams[ 'uuid' ]
111 97
@@ -365,8 +351,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
365 this.completeDescriptionShown = false 351 this.completeDescriptionShown = false
366 this.remoteServerDown = false 352 this.remoteServerDown = false
367 353
368 this.updateOtherVideosDisplayed()
369
370 if (this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())) { 354 if (this.video.isVideoNSFWForUser(this.user, this.serverService.getConfig())) {
371 const res = await this.confirmService.confirm( 355 const res = await this.confirmService.confirm(
372 this.i18n('This video contains mature or explicit content. Are you sure you want to watch it?'), 356 this.i18n('This video contains mature or explicit content. Are you sure you want to watch it?'),
@@ -474,12 +458,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
474 this.setVideoLikesBarTooltipText() 458 this.setVideoLikesBarTooltipText()
475 } 459 }
476 460
477 private updateOtherVideosDisplayed () {
478 if (this.video && this.otherVideos && this.otherVideos.length > 0) {
479 this.otherVideosDisplayed = this.otherVideos.filter(v => v.uuid !== this.video.uuid)
480 }
481 }
482
483 private setOpenGraphTags () { 461 private setOpenGraphTags () {
484 this.metaService.setTitle(this.video.name) 462 this.metaService.setTitle(this.video.name)
485 463