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-edit/video-add-components | |
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-edit/video-add-components')
-rw-r--r-- | client/src/app/videos/+video-edit/video-add-components/video-send.ts | 13 | ||||
-rw-r--r-- | client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts | 5 |
2 files changed, 12 insertions, 6 deletions
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index 580c123a0..b32f16950 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts | |||
@@ -3,7 +3,7 @@ import { LoadingBarService } from '@ngx-loading-bar/core' | |||
3 | import { AuthService, Notifier, ServerService } from '@app/core' | 3 | import { AuthService, Notifier, ServerService } from '@app/core' |
4 | import { catchError, switchMap, tap } from 'rxjs/operators' | 4 | import { catchError, switchMap, tap } from 'rxjs/operators' |
5 | import { FormReactive } from '@app/shared' | 5 | import { FormReactive } from '@app/shared' |
6 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' | 6 | import { ServerConfig, VideoConstant, VideoPrivacy } from '../../../../../../shared' |
7 | import { VideoService } from '@app/shared/video/video.service' | 7 | import { VideoService } from '@app/shared/video/video.service' |
8 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | 8 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' |
9 | import { VideoCaptionService } from '@app/shared/video-caption' | 9 | import { VideoCaptionService } from '@app/shared/video-caption' |
@@ -29,6 +29,7 @@ export abstract class VideoSend extends FormReactive implements OnInit { | |||
29 | protected serverService: ServerService | 29 | protected serverService: ServerService |
30 | protected videoService: VideoService | 30 | protected videoService: VideoService |
31 | protected videoCaptionService: VideoCaptionService | 31 | protected videoCaptionService: VideoCaptionService |
32 | protected serverConfig: ServerConfig | ||
32 | 33 | ||
33 | abstract canDeactivate (): CanComponentDeactivateResult | 34 | abstract canDeactivate (): CanComponentDeactivateResult |
34 | 35 | ||
@@ -38,10 +39,14 @@ export abstract class VideoSend extends FormReactive implements OnInit { | |||
38 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 39 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
39 | .then(() => this.firstStepChannelId = this.userVideoChannels[ 0 ].id) | 40 | .then(() => this.firstStepChannelId = this.userVideoChannels[ 0 ].id) |
40 | 41 | ||
41 | this.serverService.videoPrivaciesLoaded | 42 | this.serverConfig = this.serverService.getTmpConfig() |
43 | this.serverService.getConfig() | ||
44 | .subscribe(config => this.serverConfig = config) | ||
45 | |||
46 | this.serverService.getVideoPrivacies() | ||
42 | .subscribe( | 47 | .subscribe( |
43 | () => { | 48 | privacies => { |
44 | this.videoPrivacies = this.serverService.getVideoPrivacies() | 49 | this.videoPrivacies = privacies |
45 | 50 | ||
46 | this.firstStepPrivacyId = this.DEFAULT_VIDEO_PRIVACY | 51 | this.firstStepPrivacyId = this.DEFAULT_VIDEO_PRIVACY |
47 | }) | 52 | }) |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index 23b79edd3..28e10e562 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -14,6 +14,7 @@ import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard. | |||
14 | import { FormValidatorService, UserService } from '@app/shared' | 14 | import { FormValidatorService, UserService } from '@app/shared' |
15 | import { VideoCaptionService } from '@app/shared/video-caption' | 15 | import { VideoCaptionService } from '@app/shared/video-caption' |
16 | import { scrollToTop } from '@app/shared/misc/utils' | 16 | import { scrollToTop } from '@app/shared/misc/utils' |
17 | import { ServerConfig } from '@shared/models' | ||
17 | 18 | ||
18 | @Component({ | 19 | @Component({ |
19 | selector: 'my-video-upload', | 20 | selector: 'my-video-upload', |
@@ -70,7 +71,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
70 | } | 71 | } |
71 | 72 | ||
72 | get videoExtensions () { | 73 | get videoExtensions () { |
73 | return this.serverService.getConfig().video.file.extensions.join(',') | 74 | return this.serverConfig.video.file.extensions.join(',') |
74 | } | 75 | } |
75 | 76 | ||
76 | ngOnInit () { | 77 | ngOnInit () { |
@@ -155,7 +156,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
155 | } | 156 | } |
156 | 157 | ||
157 | const privacy = this.firstStepPrivacyId.toString() | 158 | const privacy = this.firstStepPrivacyId.toString() |
158 | const nsfw = this.serverService.getConfig().instance.isNSFW | 159 | const nsfw = this.serverConfig.instance.isNSFW |
159 | const waitTranscoding = true | 160 | const waitTranscoding = true |
160 | const commentsEnabled = true | 161 | const commentsEnabled = true |
161 | const downloadEnabled = true | 162 | const downloadEnabled = true |