Move original publication date in advanced settings
authorChocobozzz <me@florianbigard.com>
Mon, 11 Feb 2019 13:33:47 +0000 (14:33 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 11 Feb 2019 13:33:47 +0000 (14:33 +0100)
client/src/app/shared/video/video-edit.model.ts
client/src/app/videos/+video-edit/shared/video-edit.component.html
client/src/app/videos/+video-edit/shared/video-edit.component.ts
server/initializers/migrations/0340-add-originally-published-at.ts

index c5d5bb406a1649dc5ae631748baed2cc1e28eac1..1f633d427a4d0e0d08077eb1837384bd713f5919 100644 (file)
@@ -57,7 +57,7 @@ export class VideoEdit implements VideoUpdate {
       this.previewUrl = video.previewUrl
 
       this.scheduleUpdate = video.scheduledUpdate
-      this.originallyPublishedAt = new Date(video.originallyPublishedAt)
+      this.originallyPublishedAt = video.originallyPublishedAt ? new Date(video.originallyPublishedAt) : null
     }
   }
 
index 2fb5401701f6aeaf9a57dbe01b0e273fd520a55e..1be1084adf5cd35b27829dd2b13d2c1bd4cb0017 100644 (file)
               </div>
             </div>
 
-            <div class="form-group">
-              <label i18n for="originallyPublishedAt">Original publication date</label>
-              <my-help i18n-preHtml preHtml="This is the date when the content was originally published (e.g. the release date for a film)"></my-help>
-              <p-calendar
-                id="originallyPublishedAt" formControlName="originallyPublishedAt" [dateFormat]="calendarDateFormat"
-                [locale]="calendarLocale" [showTime]="true" [hideOnDateTimeSelect]="true" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="myYearRange"
-              >
-              </p-calendar>
-
-              <div *ngIf="formErrors.originallyPublishedAt" class="form-error">
-                {{ formErrors.originallyPublishedAt }}
-              </div>
-            </div>
-
             <my-peertube-checkbox
               inputName="nsfw" formControlName="nsfw"
               i18n-labelText labelText="This video contains mature or explicit content"
 
     <ngb-tab i18n-title title="Advanced settings">
       <ng-template ngbTabContent>
-        <div class="advanced-settings">
-          <div class="form-group">
-            <my-video-image
-              i18n-inputLabel inputLabel="Upload thumbnail" inputName="thumbnailfile" formControlName="thumbnailfile"
-              previewWidth="200px" previewHeight="110px"
-            ></my-video-image>
-          </div>
+        <div class="row advanced-settings">
+          <div class="col-md-12 col-xl-8">
+            <div class="form-group">
+              <my-video-image
+                i18n-inputLabel inputLabel="Upload thumbnail" inputName="thumbnailfile" formControlName="thumbnailfile"
+                previewWidth="200px" previewHeight="110px"
+              ></my-video-image>
+            </div>
 
-          <div class="form-group">
-            <my-video-image
-              i18n-inputLabel inputLabel="Upload preview" inputName="previewfile" formControlName="previewfile"
-              previewWidth="360px" previewHeight="200px"
-            ></my-video-image>
-          </div>
+            <div class="form-group">
+              <my-video-image
+                i18n-inputLabel inputLabel="Upload preview" inputName="previewfile" formControlName="previewfile"
+                previewWidth="360px" previewHeight="200px"
+              ></my-video-image>
+            </div>
 
-          <div class="form-group">
-            <label i18n for="support">Support</label>
-            <my-help helpType="markdownEnhanced" i18n-preHtml preHtml="Short text to tell people how they can support you (membership platform...)."></my-help>
-            <my-markdown-textarea
-              id="support" formControlName="support" textareaWidth="500px" [previewColumn]="true" markdownType="enhanced"
-              [classes]="{ 'input-error': formErrors['support'] }"
-            ></my-markdown-textarea>
-            <div *ngIf="formErrors.support" class="form-error">
-              {{ formErrors.support }}
+            <div class="form-group">
+              <label i18n for="support">Support</label>
+              <my-help helpType="markdownEnhanced" i18n-preHtml preHtml="Short text to tell people how they can support you (membership platform...)."></my-help>
+              <my-markdown-textarea
+                id="support" formControlName="support" textareaWidth="500px" [previewColumn]="true" markdownType="enhanced"
+                [classes]="{ 'input-error': formErrors['support'] }"
+              ></my-markdown-textarea>
+              <div *ngIf="formErrors.support" class="form-error">
+                {{ formErrors.support }}
+              </div>
             </div>
           </div>
 
-          <my-peertube-checkbox
-            inputName="commentsEnabled" formControlName="commentsEnabled"
-            i18n-labelText labelText="Enable video comments"
-          ></my-peertube-checkbox>
+          <div class="col-md-12 col-xl-4">
+            <div class="form-group originally-published-at">
+              <label i18n for="originallyPublishedAt">Original publication date</label>
+              <my-help i18n-preHtml preHtml="This is the date when the content was originally published (e.g. the release date for a film)"></my-help>
+              <p-calendar
+                id="originallyPublishedAt" formControlName="originallyPublishedAt" [dateFormat]="calendarDateFormat"
+                [locale]="calendarLocale" [showTime]="true" [hideOnDateTimeSelect]="true" [monthNavigator]="true" [yearNavigator]="true" [yearRange]="myYearRange"
+              >
+              </p-calendar>
+
+              <div *ngIf="formErrors.originallyPublishedAt" class="form-error">
+                {{ formErrors.originallyPublishedAt }}
+              </div>
+            </div>
+
+            <my-peertube-checkbox
+              inputName="commentsEnabled" formControlName="commentsEnabled"
+              i18n-labelText labelText="Enable video comments"
+            ></my-peertube-checkbox>
 
-          <my-peertube-checkbox
-            inputName="downloadEnabled" formControlName="downloadEnabled"
-            i18n-labelText labelText="Enable download"
-          ></my-peertube-checkbox>
+            <my-peertube-checkbox
+              inputName="downloadEnabled" formControlName="downloadEnabled"
+              i18n-labelText labelText="Enable download"
+            ></my-peertube-checkbox>
+          </div>
         </div>
       </ng-template>
     </ngb-tab>
index 83645294846dc97df1ee678a965cdc569a710d2e..c7ebcec257971877a73b125bd3e821d4fc4edd54 100644 (file)
@@ -26,7 +26,7 @@ export class VideoEditComponent implements OnInit, OnDestroy {
   @Input() videoPrivacies: VideoConstant<VideoPrivacy>[] = []
   @Input() userVideoChannels: { id: number, label: string, support: string }[] = []
   @Input() schedulePublicationPossible = true
-  @Input() videoCaptions: VideoCaptionEdit[] = []
+  @Input() videoCaptions: (VideoCaptionEdit & { captionPath?: string })[] = []
   @Input() waitTranscodingEnabled = true
 
   @ViewChild('videoCaptionAddModal') videoCaptionAddModal: VideoCaptionAddModalComponent
index ab8d668541adedbfaa8d7355d25b077bb78736a2..fe4f4a5f90adcfeca6345d5248160e8372ad12f4 100644 (file)
@@ -6,19 +6,13 @@ async function up (utils: {
   sequelize: Sequelize.Sequelize
 }): Promise<void> {
 
-  {
-    const data = {
-      type: Sequelize.DATE,
-      allowNull: true,
-      defaultValue: Sequelize.NOW
-    }
-    await utils.queryInterface.addColumn('video', 'originallyPublishedAt', data)
+  const data = {
+    type: Sequelize.DATE,
+    allowNull: true,
+    defaultValue: null
   }
+  await utils.queryInterface.addColumn('video', 'originallyPublishedAt', data)
 
-  {
-    const query = 'UPDATE video SET "originallyPublishedAt" = video."publishedAt"'
-    await utils.sequelize.query(query)
-  }
 }
 
 function down (options) {