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() videoToUpdate: VideoDetails
@Input() userVideoChannels: SelectChannelItem[] = [] @Input() userVideoChannels: SelectChannelItem[] = []
@Input() schedulePublicationPossible = true @Input() forbidScheduledPublication = true
@Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = [] @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = []
@ -198,13 +198,15 @@ export class VideoEditComponent implements OnInit, OnDestroy {
.subscribe(privacies => { .subscribe(privacies => {
this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies
if (this.schedulePublicationPossible) { // Can't schedule publication if private privacy is not available (could be deleted by a plugin)
this.videoPrivacies.push({ const hasPrivatePrivacy = this.videoPrivacies.some(p => p.id === VideoPrivacy.PRIVATE)
id: this.SPECIAL_SCHEDULED_PRIVACY, if (this.forbidScheduledPublication || !hasPrivatePrivacy) return
label: $localize`Scheduled`,
description: $localize`Hide the video until a specific date` 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) this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id)

View File

@ -53,7 +53,7 @@
<form [hidden]="!isInUpdateForm" novalidate [formGroup]="form"> <form [hidden]="!isInUpdateForm" novalidate [formGroup]="form">
<my-video-edit <my-video-edit
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
[schedulePublicationPossible]="false" [waitTranscodingEnabled]="isWaitTranscodingEnabled()" [forbidScheduledPublication]="true" [waitTranscodingEnabled]="isWaitTranscodingEnabled()"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo" [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo"
type="go-live" type="go-live"
></my-video-edit> ></my-video-edit>

View File

@ -59,7 +59,7 @@
<!-- Hidden because we want to load the component --> <!-- Hidden because we want to load the component -->
<form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form">
<my-video-edit <my-video-edit
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false" [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [forbidScheduledPublication]="true"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
type="import-torrent" type="import-torrent"
></my-video-edit> ></my-video-edit>

View File

@ -52,7 +52,7 @@
<!-- Hidden because we want to load the component --> <!-- Hidden because we want to load the component -->
<form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form">
<my-video-edit <my-video-edit
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false" [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [forbidScheduledPublication]="true"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
type="import-url" type="import-url"
></my-video-edit> ></my-video-edit>

View File

@ -96,7 +96,7 @@
<my-video-edit <my-video-edit
[form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
[waitTranscodingEnabled]="true" [schedulePublicationPossible]="schedulePublicationPossible" [waitTranscodingEnabled]="true" [forbidScheduledPublication]="false"
type="upload" type="upload"
></my-video-edit> ></my-video-edit>

View File

@ -47,8 +47,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
error: string error: string
enableRetryAfterError: boolean enableRetryAfterError: boolean
schedulePublicationPossible = false
// So that it can be accessed in the template // So that it can be accessed in the template
protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + '/upload-resumable' 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 this.resumableUploadService.events
.subscribe(state => this.onUploadVideoOngoing(state)) .subscribe(state => this.onUploadVideoOngoing(state))
this.schedulePublicationPossible = this.videoPrivacies.some(p => p.id === VideoPrivacy.PRIVATE)
} }
ngAfterViewInit () { ngAfterViewInit () {

View File

@ -7,7 +7,7 @@
<form novalidate [formGroup]="form"> <form novalidate [formGroup]="form">
<my-video-edit <my-video-edit
[form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible" [form]="form" [formErrors]="formErrors" [forbidScheduledPublication]="forbidScheduledPublication"
[validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels"
[videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()" [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()"
type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()" type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()"

View File

@ -24,7 +24,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
liveVideo: LiveVideo liveVideo: LiveVideo
isUpdatingVideo = false isUpdatingVideo = false
schedulePublicationPossible = false forbidScheduledPublication = false
waitTranscodingEnabled = true waitTranscodingEnabled = true
private updateDone = false private updateDone = false
@ -55,7 +55,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
this.videoCaptions = videoCaptions this.videoCaptions = videoCaptions
this.liveVideo = liveVideo this.liveVideo = liveVideo
this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE this.forbidScheduledPublication = this.video.privacy !== VideoPrivacy.PRIVATE
} }
onFormBuilt () { onFormBuilt () {