]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts
Add downloadingEnabled property to video model
[github/Chocobozzz/PeerTube.git] / client / src / app / videos / +video-edit / video-add-components / video-upload.component.ts
index b59fb7335117a0fa8e256309adf4871d3431dabf..53f72f4e6ee9038d467fa92e05dcae3d76f3089d 100644 (file)
@@ -83,7 +83,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
 
     if (this.videoUploaded === true) {
       // FIXME: cannot concatenate strings inside i18n service :/
-      text = this.i18n('Your video was uploaded to your account and is private.') +
+      text = this.i18n('Your video was uploaded to your account and is private.') + ' ' +
         this.i18n('But associated data (tags, description...) will be lost, are you sure you want to leave this page?')
     } else {
       text = this.i18n('Your video is not uploaded yet, are you sure you want to leave this page?')
@@ -123,7 +123,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
     const videoQuota = this.authService.getUser().videoQuota
     if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) {
       const msg = this.i18n(
-        'Your video quota is exceeded with this video (video size: {{ videoSize }}, used: {{ videoQuotaUsed }}, quota: {{ videoQuota }})',
+        'Your video quota is exceeded with this video (video size: {{videoSize}}, used: {{videoQuotaUsed}}, quota: {{videoQuota}})',
         {
           videoSize: bytePipes.transform(videofile.size, 0),
           videoQuotaUsed: bytePipes.transform(this.userVideoQuotaUsed, 0),
@@ -137,12 +137,11 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
     const videoQuotaDaily = this.authService.getUser().videoQuotaDaily
     if (videoQuotaDaily !== -1 && (this.userVideoQuotaUsedDaily + videofile.size) > videoQuotaDaily) {
       const msg = this.i18n(
-        'Your daily video quota is exceeded with this video (video size: {{ videoSize }}, ' +
-            'used: {{ videoQuotaUsedDaily }}, quota: {{ videoQuotaDaily }})',
+        'Your daily video quota is exceeded with this video (video size: {{videoSize}}, used: {{quotaUsedDaily}}, quota: {{quotaDaily}})',
         {
           videoSize: bytePipes.transform(videofile.size, 0),
-          videoQuotaUsedDaily: bytePipes.transform(this.userVideoQuotaUsedDaily, 0),
-          videoQuotaDaily: bytePipes.transform(videoQuotaDaily, 0)
+          quotaUsedDaily: bytePipes.transform(this.userVideoQuotaUsedDaily, 0),
+          quotaDaily: bytePipes.transform(videoQuotaDaily, 0)
         }
       )
       this.notificationsService.error(this.i18n('Error'), msg)
@@ -160,6 +159,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
     const nsfw = false
     const waitTranscoding = true
     const commentsEnabled = true
+    const downloadingEnabled = true
     const channelId = this.firstStepChannelId.toString()
 
     const formData = new FormData()
@@ -168,6 +168,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
     formData.append('privacy', VideoPrivacy.PRIVATE.toString())
     formData.append('nsfw', '' + nsfw)
     formData.append('commentsEnabled', '' + commentsEnabled)
+    formData.append('downloadingEnabled', '' + downloadingEnabled)
     formData.append('waitTranscoding', '' + waitTranscoding)
     formData.append('channelId', '' + channelId)
     formData.append('videofile', videofile)
@@ -182,6 +183,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
       channelId
     })
 
+    this.videoPrivacies = this.videoService.explainedPrivacyLabels(this.videoPrivacies)
+
     this.videoUploadObservable = this.videoService.uploadVideo(formData).subscribe(
       event => {
         if (event.type === HttpEventType.UploadProgress) {
@@ -205,6 +208,12 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy
     )
   }
 
+  isPublishingButtonDisabled () {
+    return !this.form.valid ||
+      this.isUpdatingVideo === true ||
+      this.videoUploaded !== true
+  }
+
   updateSecondStep () {
     if (this.checkForm() === false) {
       return