diff options
author | Chocobozzz <me@florianbigard.com> | 2019-06-07 14:50:27 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-06-07 15:01:55 +0200 |
commit | 851f5daa1eec66e1faa3c45238ec9ab91be05b00 (patch) | |
tree | a13952cde4ad4434aeaa1894e0270d0515638650 /client | |
parent | 1b319b7aa6d2f4252615b370aaca6a800be1b1f4 (diff) | |
download | PeerTube-851f5daa1eec66e1faa3c45238ec9ab91be05b00.tar.gz PeerTube-851f5daa1eec66e1faa3c45238ec9ab91be05b00.tar.zst PeerTube-851f5daa1eec66e1faa3c45238ec9ab91be05b00.zip |
Add ability to set a public to private in client
Diffstat (limited to 'client')
12 files changed, 32 insertions, 54 deletions
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts index 87a10961f..8aed8b513 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts | |||
@@ -7,7 +7,6 @@ import { FormValidatorService } from '@app/shared/forms/form-validators/form-val | |||
7 | import { VideoPlaylistValidatorsService } from '@app/shared' | 7 | import { VideoPlaylistValidatorsService } from '@app/shared' |
8 | import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' | 8 | import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' |
9 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 9 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
10 | import { VideoConstant } from '@shared/models' | ||
11 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' | 10 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' |
12 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | 11 | import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' |
13 | 12 | ||
@@ -18,7 +17,6 @@ import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | |||
18 | }) | 17 | }) |
19 | export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylistEdit implements OnInit { | 18 | export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylistEdit implements OnInit { |
20 | error: string | 19 | error: string |
21 | videoPlaylistPrivacies: VideoConstant<VideoPlaylistPrivacy>[] = [] | ||
22 | 20 | ||
23 | constructor ( | 21 | constructor ( |
24 | protected formValidatorService: FormValidatorService, | 22 | protected formValidatorService: FormValidatorService, |
@@ -47,6 +45,7 @@ export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylis | |||
47 | }) | 45 | }) |
48 | 46 | ||
49 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 47 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
48 | .catch(err => console.error('Cannot populate user video channels.', err)) | ||
50 | 49 | ||
51 | this.serverService.videoPlaylistPrivaciesLoaded.subscribe( | 50 | this.serverService.videoPlaylistPrivaciesLoaded.subscribe( |
52 | () => { | 51 | () => { |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts index 81dd9a75f..e94188786 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-edit.ts | |||
@@ -1,10 +1,12 @@ | |||
1 | import { FormReactive } from '@app/shared' | 1 | import { FormReactive } from '@app/shared' |
2 | import { VideoPlaylist } from '@shared/models/videos/playlist/video-playlist.model' | 2 | import { VideoPlaylist } from '@shared/models/videos/playlist/video-playlist.model' |
3 | import { VideoConstant, VideoPlaylistPrivacy } from '@shared/models' | ||
3 | 4 | ||
4 | export abstract class MyAccountVideoPlaylistEdit extends FormReactive { | 5 | export abstract class MyAccountVideoPlaylistEdit extends FormReactive { |
5 | // Declare it here to avoid errors in create template | 6 | // Declare it here to avoid errors in create template |
6 | videoPlaylistToUpdate: VideoPlaylist | 7 | videoPlaylistToUpdate: VideoPlaylist |
7 | userVideoChannels: { id: number, label: string }[] = [] | 8 | userVideoChannels: { id: number, label: string }[] = [] |
9 | videoPlaylistPrivacies: VideoConstant<VideoPlaylistPrivacy>[] = [] | ||
8 | 10 | ||
9 | abstract isCreation (): boolean | 11 | abstract isCreation (): boolean |
10 | abstract getFormButtonTitle (): string | 12 | abstract getFormButtonTitle (): string |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts index 4887fdfb4..917ad7258 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts | |||
@@ -9,9 +9,8 @@ import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils' | |||
9 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' | 9 | import { VideoPlaylistService } from '@app/shared/video-playlist/video-playlist.service' |
10 | import { VideoPlaylistValidatorsService } from '@app/shared' | 10 | import { VideoPlaylistValidatorsService } from '@app/shared' |
11 | import { VideoPlaylistUpdate } from '@shared/models/videos/playlist/video-playlist-update.model' | 11 | import { VideoPlaylistUpdate } from '@shared/models/videos/playlist/video-playlist-update.model' |
12 | import { VideoConstant } from '@shared/models' | ||
13 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' | ||
14 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | 12 | import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' |
13 | import { delayWhen, map, switchMap } from 'rxjs/operators' | ||
15 | 14 | ||
16 | @Component({ | 15 | @Component({ |
17 | selector: 'my-account-video-playlist-update', | 16 | selector: 'my-account-video-playlist-update', |
@@ -21,7 +20,6 @@ import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model' | |||
21 | export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylistEdit implements OnInit, OnDestroy { | 20 | export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylistEdit implements OnInit, OnDestroy { |
22 | error: string | 21 | error: string |
23 | videoPlaylistToUpdate: VideoPlaylist | 22 | videoPlaylistToUpdate: VideoPlaylist |
24 | videoPlaylistPrivacies: VideoConstant<VideoPlaylistPrivacy>[] = [] | ||
25 | 23 | ||
26 | private paramsSub: Subscription | 24 | private paramsSub: Subscription |
27 | 25 | ||
@@ -53,31 +51,24 @@ export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylis | |||
53 | }) | 51 | }) |
54 | 52 | ||
55 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) | 53 | populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) |
56 | 54 | .catch(err => console.error('Cannot populate user video channels.', err)) | |
57 | this.paramsSub = this.route.params.subscribe(routeParams => { | 55 | |
58 | const videoPlaylistId = routeParams['videoPlaylistId'] | 56 | this.paramsSub = this.route.params |
59 | 57 | .pipe( | |
60 | this.videoPlaylistService.getVideoPlaylist(videoPlaylistId).subscribe( | 58 | map(routeParams => routeParams['videoPlaylistId']), |
61 | videoPlaylistToUpdate => { | 59 | switchMap(videoPlaylistId => this.videoPlaylistService.getVideoPlaylist(videoPlaylistId)), |
62 | this.videoPlaylistToUpdate = videoPlaylistToUpdate | 60 | delayWhen(() => this.serverService.videoPlaylistPrivaciesLoaded) |
63 | 61 | ) | |
64 | this.hydrateFormFromPlaylist() | 62 | .subscribe( |
65 | 63 | videoPlaylistToUpdate => { | |
66 | this.serverService.videoPlaylistPrivaciesLoaded.subscribe( | 64 | this.videoPlaylistPrivacies = this.serverService.getVideoPlaylistPrivacies() |
67 | () => { | 65 | this.videoPlaylistToUpdate = videoPlaylistToUpdate |
68 | this.videoPlaylistPrivacies = this.serverService.getVideoPlaylistPrivacies() | 66 | |
69 | .filter(p => { | 67 | this.hydrateFormFromPlaylist() |
70 | // If the playlist is not private, we cannot put it in private anymore | 68 | }, |
71 | return this.videoPlaylistToUpdate.privacy.id === VideoPlaylistPrivacy.PRIVATE || | 69 | |
72 | p.id !== VideoPlaylistPrivacy.PRIVATE | 70 | err => this.error = err.message |
73 | }) | 71 | ) |
74 | } | ||
75 | ) | ||
76 | }, | ||
77 | |||
78 | err => this.error = err.message | ||
79 | ) | ||
80 | }) | ||
81 | } | 72 | } |
82 | 73 | ||
83 | ngOnDestroy () { | 74 | ngOnDestroy () { |
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts index 95d397b52..a2776b73d 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts | |||
@@ -13,6 +13,7 @@ import { VideoCaptionAddModalComponent } from '@app/videos/+video-edit/shared/vi | |||
13 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | 13 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' |
14 | import { removeElementFromArray } from '@app/shared/misc/utils' | 14 | import { removeElementFromArray } from '@app/shared/misc/utils' |
15 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' | 15 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' |
16 | import { VideoService } from '@app/shared/video/video.service' | ||
16 | 17 | ||
17 | @Component({ | 18 | @Component({ |
18 | selector: 'my-video-edit', | 19 | selector: 'my-video-edit', |
@@ -23,7 +24,6 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
23 | @Input() form: FormGroup | 24 | @Input() form: FormGroup |
24 | @Input() formErrors: { [ id: string ]: string } = {} | 25 | @Input() formErrors: { [ id: string ]: string } = {} |
25 | @Input() validationMessages: FormReactiveValidationMessages = {} | 26 | @Input() validationMessages: FormReactiveValidationMessages = {} |
26 | @Input() videoPrivacies: VideoConstant<VideoPrivacy>[] = [] | ||
27 | @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] | 27 | @Input() userVideoChannels: { id: number, label: string, support: string }[] = [] |
28 | @Input() schedulePublicationPossible = true | 28 | @Input() schedulePublicationPossible = true |
29 | @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = [] | 29 | @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = [] |
@@ -34,6 +34,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
34 | // So that it can be accessed in the template | 34 | // So that it can be accessed in the template |
35 | readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY | 35 | readonly SPECIAL_SCHEDULED_PRIVACY = VideoEdit.SPECIAL_SCHEDULED_PRIVACY |
36 | 36 | ||
37 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] | ||
37 | videoCategories: VideoConstant<number>[] = [] | 38 | videoCategories: VideoConstant<number>[] = [] |
38 | videoLicences: VideoConstant<number>[] = [] | 39 | videoLicences: VideoConstant<number>[] = [] |
39 | videoLanguages: VideoConstant<string>[] = [] | 40 | videoLanguages: VideoConstant<string>[] = [] |
@@ -58,6 +59,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
58 | private formValidatorService: FormValidatorService, | 59 | private formValidatorService: FormValidatorService, |
59 | private videoValidatorsService: VideoValidatorsService, | 60 | private videoValidatorsService: VideoValidatorsService, |
60 | private videoCaptionService: VideoCaptionService, | 61 | private videoCaptionService: VideoCaptionService, |
62 | private videoService: VideoService, | ||
61 | private route: ActivatedRoute, | 63 | private route: ActivatedRoute, |
62 | private router: Router, | 64 | private router: Router, |
63 | private notifier: Notifier, | 65 | private notifier: Notifier, |
@@ -132,6 +134,9 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
132 | this.videoLicences = this.serverService.getVideoLicences() | 134 | this.videoLicences = this.serverService.getVideoLicences() |
133 | this.videoLanguages = this.serverService.getVideoLanguages() | 135 | this.videoLanguages = this.serverService.getVideoLanguages() |
134 | 136 | ||
137 | const privacies = this.serverService.getVideoPrivacies() | ||
138 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies) | ||
139 | |||
135 | this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id) | 140 | this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id) |
136 | 141 | ||
137 | this.ngZone.runOutsideAngular(() => { | 142 | this.ngZone.runOutsideAngular(() => { |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html index 537d7ffa2..7a495fea5 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.html | |||
@@ -58,7 +58,7 @@ | |||
58 | <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> | 58 | <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> |
59 | <my-video-edit | 59 | <my-video-edit |
60 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false" | 60 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false" |
61 | [validationMessages]="validationMessages" [videoPrivacies]="explainedVideoPrivacies" [userVideoChannels]="userVideoChannels" | 61 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" |
62 | ></my-video-edit> | 62 | ></my-video-edit> |
63 | 63 | ||
64 | <div class="submit-container"> | 64 | <div class="submit-container"> |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index d2e9f6cfe..ed9cb5840 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -100,7 +100,6 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
100 | previewUrl: null | 100 | previewUrl: null |
101 | })) | 101 | })) |
102 | 102 | ||
103 | this.explainedVideoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) | ||
104 | 103 | ||
105 | this.hydrateFormFromVideo() | 104 | this.hydrateFormFromVideo() |
106 | }, | 105 | }, |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html index 984b9d590..e4f19faa8 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.html | |||
@@ -51,7 +51,7 @@ | |||
51 | <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> | 51 | <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> |
52 | <my-video-edit | 52 | <my-video-edit |
53 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false" | 53 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false" |
54 | [validationMessages]="validationMessages" [videoPrivacies]="explainedVideoPrivacies" [userVideoChannels]="userVideoChannels" | 54 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" |
55 | ></my-video-edit> | 55 | ></my-video-edit> |
56 | 56 | ||
57 | <div class="submit-container"> | 57 | <div class="submit-container"> |
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 8401caeec..580c123a0 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 | |||
@@ -14,7 +14,6 @@ import { CanComponentDeactivateResult } from '@app/shared/guards/can-deactivate- | |||
14 | export abstract class VideoSend extends FormReactive implements OnInit { | 14 | export abstract class VideoSend extends FormReactive implements OnInit { |
15 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 15 | userVideoChannels: { id: number, label: string, support: string }[] = [] |
16 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] | 16 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] |
17 | explainedVideoPrivacies: VideoConstant<VideoPrivacy>[] = [] | ||
18 | videoCaptions: VideoCaptionEdit[] = [] | 17 | videoCaptions: VideoCaptionEdit[] = [] |
19 | 18 | ||
20 | firstStepPrivacyId = 0 | 19 | firstStepPrivacyId = 0 |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html index 3247a2bd6..0f904affb 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.html | |||
@@ -71,7 +71,7 @@ | |||
71 | <form [hidden]="!isUploadingVideo" novalidate [formGroup]="form"> | 71 | <form [hidden]="!isUploadingVideo" novalidate [formGroup]="form"> |
72 | <my-video-edit | 72 | <my-video-edit |
73 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" | 73 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" |
74 | [validationMessages]="validationMessages" [videoPrivacies]="explainedVideoPrivacies" [userVideoChannels]="userVideoChannels" | 74 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" |
75 | [waitTranscodingEnabled]="waitTranscodingEnabled" | 75 | [waitTranscodingEnabled]="waitTranscodingEnabled" |
76 | ></my-video-edit> | 76 | ></my-video-edit> |
77 | 77 | ||
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 73de25c59..69fa13a2f 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 | |||
@@ -188,8 +188,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
188 | previewfile: this.previewfileUpload | 188 | previewfile: this.previewfileUpload |
189 | }) | 189 | }) |
190 | 190 | ||
191 | this.explainedVideoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) | ||
192 | |||
193 | this.videoUploadObservable = this.videoService.uploadVideo(formData).subscribe( | 191 | this.videoUploadObservable = this.videoService.uploadVideo(formData).subscribe( |
194 | event => { | 192 | event => { |
195 | if (event.type === HttpEventType.UploadProgress) { | 193 | if (event.type === HttpEventType.UploadProgress) { |
diff --git a/client/src/app/videos/+video-edit/video-update.component.html b/client/src/app/videos/+video-edit/video-update.component.html index b5cab7ed5..aa148311f 100644 --- a/client/src/app/videos/+video-edit/video-update.component.html +++ b/client/src/app/videos/+video-edit/video-update.component.html | |||
@@ -7,7 +7,7 @@ | |||
7 | 7 | ||
8 | <my-video-edit | 8 | <my-video-edit |
9 | [form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible" | 9 | [form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible" |
10 | [validationMessages]="validationMessages" [videoPrivacies]="explainedVideoPrivacies" [userVideoChannels]="userVideoChannels" | 10 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" |
11 | [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="waitTranscodingEnabled" | 11 | [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="waitTranscodingEnabled" |
12 | ></my-video-edit> | 12 | ></my-video-edit> |
13 | 13 | ||
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts index 10f797d02..e990ceb13 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts | |||
@@ -3,7 +3,6 @@ import { Component, HostListener, OnInit } from '@angular/core' | |||
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { LoadingBarService } from '@ngx-loading-bar/core' | 4 | import { LoadingBarService } from '@ngx-loading-bar/core' |
5 | import { Notifier } from '@app/core' | 5 | import { Notifier } from '@app/core' |
6 | import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos' | ||
7 | import { ServerService } from '../../core' | 6 | import { ServerService } from '../../core' |
8 | import { FormReactive } from '../../shared' | 7 | import { FormReactive } from '../../shared' |
9 | import { VideoEdit } from '../../shared/video/video-edit.model' | 8 | import { VideoEdit } from '../../shared/video/video-edit.model' |
@@ -23,8 +22,6 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
23 | video: VideoEdit | 22 | video: VideoEdit |
24 | 23 | ||
25 | isUpdatingVideo = false | 24 | isUpdatingVideo = false |
26 | videoPrivacies: VideoConstant<VideoPrivacy>[] = [] | ||
27 | explainedVideoPrivacies: VideoConstant<VideoPrivacy>[] = [] | ||
28 | userVideoChannels: { id: number, label: string, support: string }[] = [] | 25 | userVideoChannels: { id: number, label: string, support: string }[] = [] |
29 | schedulePublicationPossible = false | 26 | schedulePublicationPossible = false |
30 | videoCaptions: VideoCaptionEdit[] = [] | 27 | videoCaptions: VideoCaptionEdit[] = [] |
@@ -49,9 +46,6 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
49 | ngOnInit () { | 46 | ngOnInit () { |
50 | this.buildForm({}) | 47 | this.buildForm({}) |
51 | 48 | ||
52 | this.serverService.videoPrivaciesLoaded | ||
53 | .subscribe(() => this.videoPrivacies = this.serverService.getVideoPrivacies()) | ||
54 | |||
55 | this.route.data | 49 | this.route.data |
56 | .pipe(map(data => data.videoData)) | 50 | .pipe(map(data => data.videoData)) |
57 | .subscribe(({ video, videoChannels, videoCaptions }) => { | 51 | .subscribe(({ video, videoChannels, videoCaptions }) => { |
@@ -59,15 +53,6 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
59 | this.userVideoChannels = videoChannels | 53 | this.userVideoChannels = videoChannels |
60 | this.videoCaptions = videoCaptions | 54 | this.videoCaptions = videoCaptions |
61 | 55 | ||
62 | // We cannot set private a video that was not private | ||
63 | if (this.video.privacy !== VideoPrivacy.PRIVATE) { | ||
64 | this.videoPrivacies = this.videoPrivacies.filter(p => p.id !== VideoPrivacy.PRIVATE) | ||
65 | } else { // We can schedule video publication only if it it is private | ||
66 | this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE | ||
67 | } | ||
68 | |||
69 | this.explainedVideoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies) | ||
70 | |||
71 | const videoFiles = (video as VideoDetails).files | 56 | const videoFiles = (video as VideoDetails).files |
72 | if (videoFiles.length > 1) { // Already transcoded | 57 | if (videoFiles.length > 1) { // Already transcoded |
73 | this.waitTranscodingEnabled = false | 58 | this.waitTranscodingEnabled = false |