From 4afec7357129590b0e0f3558ecb9ac20e0903600 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 7 Feb 2022 10:27:08 +0100 Subject: Fix scheduled publication on upload --- .../+videos/+video-edit/shared/video-edit.component.ts | 18 ++++++++++-------- .../video-add-components/video-go-live.component.html | 2 +- .../video-import-torrent.component.html | 2 +- .../video-import-url.component.html | 2 +- .../video-add-components/video-upload.component.html | 2 +- .../video-add-components/video-upload.component.ts | 4 ---- .../+videos/+video-edit/video-update.component.html | 2 +- .../app/+videos/+video-edit/video-update.component.ts | 4 ++-- 8 files changed, 17 insertions(+), 19 deletions(-) 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 be3bbe9be..31dbe43e6 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 @@ -56,7 +56,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { @Input() videoToUpdate: VideoDetails @Input() userVideoChannels: SelectChannelItem[] = [] - @Input() schedulePublicationPossible = true + @Input() forbidScheduledPublication = true @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = [] @@ -198,13 +198,15 @@ export class VideoEditComponent implements OnInit, OnDestroy { .subscribe(privacies => { this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies - if (this.schedulePublicationPossible) { - this.videoPrivacies.push({ - id: this.SPECIAL_SCHEDULED_PRIVACY, - label: $localize`Scheduled`, - description: $localize`Hide the video until a specific date` - }) - } + // Can't schedule publication if private privacy is not available (could be deleted by a plugin) + const hasPrivatePrivacy = this.videoPrivacies.some(p => p.id === VideoPrivacy.PRIVATE) + if (this.forbidScheduledPublication || !hasPrivatePrivacy) return + + this.videoPrivacies.push({ + id: this.SPECIAL_SCHEDULED_PRIVACY, + label: $localize`Scheduled`, + description: $localize`Hide the video until a specific date` + }) }) this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id) diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html index fce5a1ee5..ecec6045b 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.html @@ -53,7 +53,7 @@
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 0f1a94c84..14a7a287a 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 @@ -59,7 +59,7 @@ 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 93d3c6b5f..60a43c870 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 @@ -52,7 +52,7 @@ 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 db494a02f..860fb76fa 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 @@ -96,7 +96,7 @@ 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 2251b0511..4e77cac47 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 @@ -47,8 +47,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy error: string enableRetryAfterError: boolean - schedulePublicationPossible = false - // So that it can be accessed in the template protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + '/upload-resumable' @@ -107,8 +105,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy this.resumableUploadService.events .subscribe(state => this.onUploadVideoOngoing(state)) - - this.schedulePublicationPossible = this.videoPrivacies.some(p => p.id === VideoPrivacy.PRIVATE) } ngAfterViewInit () { 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 ca322318c..4376f6fe4 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 @@