Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix scheduled publication on upload

Chocobozzz4afec7357129
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 be3bbe9be8..31dbe43e69 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 fce5a1ee50..ecec6045ba 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 @@
<form [hidden]="!isInUpdateForm" novalidate [formGroup]="form">
<my-video-edit
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
- [schedulePublicationPossible]="false" [waitTranscodingEnabled]="isWaitTranscodingEnabled()"
+ [forbidScheduledPublication]="true" [waitTranscodingEnabled]="isWaitTranscodingEnabled()"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo"
type="go-live"
></my-video-edit>
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 0f1a94c84b..14a7a287ac 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 @@
<!-- Hidden because we want to load the component -->
<form [hidden]="!hasImportedVideo" novalidate [formGroup]="form">
<my-video-edit
- [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false"
+ [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [forbidScheduledPublication]="true"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
type="import-torrent"
></my-video-edit>
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 93d3c6b5fc..60a43c870f 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 @@
<!-- Hidden because we want to load the component -->
<form [hidden]="!hasImportedVideo" novalidate [formGroup]="form">
<my-video-edit
- [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false"
+ [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [forbidScheduledPublication]="true"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
type="import-url"
></my-video-edit>
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 db494a02f7..860fb76fa1 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 @@
<my-video-edit
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
- [waitTranscodingEnabled]="true" [schedulePublicationPossible]="schedulePublicationPossible"
+ [waitTranscodingEnabled]="true" [forbidScheduledPublication]="false"
type="upload"
></my-video-edit>
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 2251b05119..4e77cac475 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 ca322318c6..4376f6fe4b 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 @@
<form novalidate [formGroup]="form">
<my-video-edit
- [form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible"
+ [form]="form" [formErrors]="formErrors" [forbidScheduledPublication]="forbidScheduledPublication"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
[videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()"
type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()"
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 5e4955f6ae..d9e8344fcd 100644
--- a/client/src/app/+videos/+video-edit/video-update.component.ts
+++ b/client/src/app/+videos/+video-edit/video-update.component.ts
@@ -24,7 +24,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
liveVideo: LiveVideo
isUpdatingVideo = false
- schedulePublicationPossible = false
+ forbidScheduledPublication = false
waitTranscodingEnabled = true
private updateDone = false
@@ -55,7 +55,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
this.videoCaptions = videoCaptions
this.liveVideo = liveVideo
- this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE
+ this.forbidScheduledPublication = this.video.privacy !== VideoPrivacy.PRIVATE
}
onFormBuilt () {