Fix scheduled publication on upload

pull/4795/head
Chocobozzz 2022-02-07 10:27:08 +01:00
parent 4393b2552c
commit 4afec73571
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
8 changed files with 17 additions and 19 deletions

View File

@ -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)

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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 () {

View File

@ -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()"

View File

@ -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 () {