diff options
author | Chocobozzz <me@florianbigard.com> | 2022-02-07 10:27:08 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-02-07 10:27:08 +0100 |
commit | 4afec7357129590b0e0f3558ecb9ac20e0903600 (patch) | |
tree | 3c06c04ed4e2866e9102bfdb6882bd7f68a084a1 | |
parent | 4393b2552c4ecb9fe43ff78480da0826c04709c0 (diff) | |
download | PeerTube-4afec7357129590b0e0f3558ecb9ac20e0903600.tar.gz PeerTube-4afec7357129590b0e0f3558ecb9ac20e0903600.tar.zst PeerTube-4afec7357129590b0e0f3558ecb9ac20e0903600.zip |
Fix scheduled publication on upload
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 { | |||
56 | @Input() videoToUpdate: VideoDetails | 56 | @Input() videoToUpdate: VideoDetails |
57 | 57 | ||
58 | @Input() userVideoChannels: SelectChannelItem[] = [] | 58 | @Input() userVideoChannels: SelectChannelItem[] = [] |
59 | @Input() schedulePublicationPossible = true | 59 | @Input() forbidScheduledPublication = true |
60 | 60 | ||
61 | @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = [] | 61 | @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = [] |
62 | 62 | ||
@@ -198,13 +198,15 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
198 | .subscribe(privacies => { | 198 | .subscribe(privacies => { |
199 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies | 199 | this.videoPrivacies = this.videoService.explainedPrivacyLabels(privacies).videoPrivacies |
200 | 200 | ||
201 | if (this.schedulePublicationPossible) { | 201 | // Can't schedule publication if private privacy is not available (could be deleted by a plugin) |
202 | this.videoPrivacies.push({ | 202 | const hasPrivatePrivacy = this.videoPrivacies.some(p => p.id === VideoPrivacy.PRIVATE) |
203 | id: this.SPECIAL_SCHEDULED_PRIVACY, | 203 | if (this.forbidScheduledPublication || !hasPrivatePrivacy) return |
204 | label: $localize`Scheduled`, | 204 | |
205 | description: $localize`Hide the video until a specific date` | 205 | this.videoPrivacies.push({ |
206 | }) | 206 | id: this.SPECIAL_SCHEDULED_PRIVACY, |
207 | } | 207 | label: $localize`Scheduled`, |
208 | description: $localize`Hide the video until a specific date` | ||
209 | }) | ||
208 | }) | 210 | }) |
209 | 211 | ||
210 | this.initialVideoCaptions = this.videoCaptions.map(c => c.language.id) | 212 | 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 @@ | |||
53 | <form [hidden]="!isInUpdateForm" novalidate [formGroup]="form"> | 53 | <form [hidden]="!isInUpdateForm" novalidate [formGroup]="form"> |
54 | <my-video-edit | 54 | <my-video-edit |
55 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" | 55 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" |
56 | [schedulePublicationPossible]="false" [waitTranscodingEnabled]="isWaitTranscodingEnabled()" | 56 | [forbidScheduledPublication]="true" [waitTranscodingEnabled]="isWaitTranscodingEnabled()" |
57 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo" | 57 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" [liveVideo]="liveVideo" |
58 | type="go-live" | 58 | type="go-live" |
59 | ></my-video-edit> | 59 | ></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 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 @@ | |||
59 | <!-- Hidden because we want to load the component --> | 59 | <!-- Hidden because we want to load the component --> |
60 | <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> | 60 | <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> |
61 | <my-video-edit | 61 | <my-video-edit |
62 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false" | 62 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [forbidScheduledPublication]="true" |
63 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" | 63 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" |
64 | type="import-torrent" | 64 | type="import-torrent" |
65 | ></my-video-edit> | 65 | ></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 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 @@ | |||
52 | <!-- Hidden because we want to load the component --> | 52 | <!-- Hidden because we want to load the component --> |
53 | <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> | 53 | <form [hidden]="!hasImportedVideo" novalidate [formGroup]="form"> |
54 | <my-video-edit | 54 | <my-video-edit |
55 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [schedulePublicationPossible]="false" | 55 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" [forbidScheduledPublication]="true" |
56 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" | 56 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" |
57 | type="import-url" | 57 | type="import-url" |
58 | ></my-video-edit> | 58 | ></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 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 @@ | |||
96 | <my-video-edit | 96 | <my-video-edit |
97 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" | 97 | [form]="form" [formErrors]="formErrors" [videoCaptions]="videoCaptions" |
98 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" | 98 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" |
99 | [waitTranscodingEnabled]="true" [schedulePublicationPossible]="schedulePublicationPossible" | 99 | [waitTranscodingEnabled]="true" [forbidScheduledPublication]="false" |
100 | type="upload" | 100 | type="upload" |
101 | ></my-video-edit> | 101 | ></my-video-edit> |
102 | 102 | ||
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 | |||
47 | error: string | 47 | error: string |
48 | enableRetryAfterError: boolean | 48 | enableRetryAfterError: boolean |
49 | 49 | ||
50 | schedulePublicationPossible = false | ||
51 | |||
52 | // So that it can be accessed in the template | 50 | // So that it can be accessed in the template |
53 | protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + '/upload-resumable' | 51 | protected readonly BASE_VIDEO_UPLOAD_URL = VideoService.BASE_VIDEO_URL + '/upload-resumable' |
54 | 52 | ||
@@ -107,8 +105,6 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
107 | 105 | ||
108 | this.resumableUploadService.events | 106 | this.resumableUploadService.events |
109 | .subscribe(state => this.onUploadVideoOngoing(state)) | 107 | .subscribe(state => this.onUploadVideoOngoing(state)) |
110 | |||
111 | this.schedulePublicationPossible = this.videoPrivacies.some(p => p.id === VideoPrivacy.PRIVATE) | ||
112 | } | 108 | } |
113 | 109 | ||
114 | ngAfterViewInit () { | 110 | 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 @@ | |||
7 | <form novalidate [formGroup]="form"> | 7 | <form novalidate [formGroup]="form"> |
8 | 8 | ||
9 | <my-video-edit | 9 | <my-video-edit |
10 | [form]="form" [formErrors]="formErrors" [schedulePublicationPossible]="schedulePublicationPossible" | 10 | [form]="form" [formErrors]="formErrors" [forbidScheduledPublication]="forbidScheduledPublication" |
11 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" | 11 | [validationMessages]="validationMessages" [userVideoChannels]="userVideoChannels" |
12 | [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()" | 12 | [videoCaptions]="videoCaptions" [waitTranscodingEnabled]="isWaitTranscodingEnabled()" |
13 | type="update" (pluginFieldsAdded)="hydratePluginFieldsFromVideo()" | 13 | 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 5e4955f6a..d9e8344fc 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 { | |||
24 | liveVideo: LiveVideo | 24 | liveVideo: LiveVideo |
25 | 25 | ||
26 | isUpdatingVideo = false | 26 | isUpdatingVideo = false |
27 | schedulePublicationPossible = false | 27 | forbidScheduledPublication = false |
28 | waitTranscodingEnabled = true | 28 | waitTranscodingEnabled = true |
29 | 29 | ||
30 | private updateDone = false | 30 | private updateDone = false |
@@ -55,7 +55,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
55 | this.videoCaptions = videoCaptions | 55 | this.videoCaptions = videoCaptions |
56 | this.liveVideo = liveVideo | 56 | this.liveVideo = liveVideo |
57 | 57 | ||
58 | this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE | 58 | this.forbidScheduledPublication = this.video.privacy !== VideoPrivacy.PRIVATE |
59 | } | 59 | } |
60 | 60 | ||
61 | onFormBuilt () { | 61 | onFormBuilt () { |