diff options
author | Chocobozzz <me@florianbigard.com> | 2019-12-18 15:31:54 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-12-18 15:40:59 +0100 |
commit | ba430d7516bc5b1324b60571ba7594460969b7fb (patch) | |
tree | df5c6952c82f49a94c0a884bbc97d4a0cbd9f867 /client/src/app/videos/+video-watch | |
parent | 5dfb7c1dec8222b0bbccac5b56ad46da1438747e (diff) | |
download | PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.gz PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.tar.zst PeerTube-ba430d7516bc5b1324b60571ba7594460969b7fb.zip |
Lazy load static objects
Diffstat (limited to 'client/src/app/videos/+video-watch')
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 16 |
1 files changed, 11 insertions, 5 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 8cc1e8b58..626d0ca07 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -8,7 +8,7 @@ import { MetaService } from '@ngx-meta/core' | |||
8 | import { AuthUser, Notifier, ServerService } from '@app/core' | 8 | import { AuthUser, Notifier, ServerService } from '@app/core' |
9 | import { forkJoin, Observable, Subscription } from 'rxjs' | 9 | import { forkJoin, Observable, Subscription } from 'rxjs' |
10 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | 10 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' |
11 | import { UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' | 11 | import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' |
12 | import { AuthService, ConfirmService } from '../../core' | 12 | import { AuthService, ConfirmService } from '../../core' |
13 | import { RestExtractor, VideoBlacklistService } from '../../shared' | 13 | import { RestExtractor, VideoBlacklistService } from '../../shared' |
14 | import { VideoDetails } from '../../shared/video/video-details.model' | 14 | import { VideoDetails } from '../../shared/video/video-details.model' |
@@ -84,6 +84,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
84 | private queryParamsSub: Subscription | 84 | private queryParamsSub: Subscription |
85 | private configSub: Subscription | 85 | private configSub: Subscription |
86 | 86 | ||
87 | private serverConfig: ServerConfig | ||
88 | |||
87 | constructor ( | 89 | constructor ( |
88 | private elementRef: ElementRef, | 90 | private elementRef: ElementRef, |
89 | private changeDetector: ChangeDetectorRef, | 91 | private changeDetector: ChangeDetectorRef, |
@@ -120,11 +122,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
120 | } | 122 | } |
121 | 123 | ||
122 | async ngOnInit () { | 124 | async ngOnInit () { |
123 | this.configSub = this.serverService.configLoaded | 125 | this.serverConfig = this.serverService.getTmpConfig() |
124 | .subscribe(() => { | 126 | |
127 | this.configSub = this.serverService.getConfig() | ||
128 | .subscribe(config => { | ||
129 | this.serverConfig = config | ||
130 | |||
125 | if ( | 131 | if ( |
126 | isWebRTCDisabled() || | 132 | isWebRTCDisabled() || |
127 | this.serverService.getConfig().tracker.enabled === false || | 133 | this.serverConfig.tracker.enabled === false || |
128 | peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true' | 134 | peertubeLocalStorage.getItem(VideoWatchComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY) === 'true' |
129 | ) { | 135 | ) { |
130 | this.hasAlreadyAcceptedPrivacyConcern = true | 136 | this.hasAlreadyAcceptedPrivacyConcern = true |
@@ -280,7 +286,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
280 | } | 286 | } |
281 | 287 | ||
282 | isVideoBlur (video: Video) { | 288 | isVideoBlur (video: Video) { |
283 | return video.isVideoNSFWForUser(this.user, this.serverService.getConfig()) | 289 | return video.isVideoNSFWForUser(this.user, this.serverConfig) |
284 | } | 290 | } |
285 | 291 | ||
286 | isAutoPlayEnabled () { | 292 | isAutoPlayEnabled () { |