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 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'client/src/app/+videos/+video-edit/shared') 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) -- cgit v1.2.3