]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Merge branch 'develop' into pr/1285
authorChocobozzz <me@florianbigard.com>
Mon, 11 Feb 2019 13:09:23 +0000 (14:09 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 11 Feb 2019 13:09:23 +0000 (14:09 +0100)
19 files changed:
1  2 
client/src/app/shared/video-import/video-import.service.ts
client/src/app/shared/video/video-edit.model.ts
client/src/app/shared/video/video.model.ts
client/src/app/shared/video/video.service.ts
client/src/app/videos/+video-edit/shared/video-edit.component.html
client/src/app/videos/+video-edit/shared/video-edit.component.ts
client/src/app/videos/+video-watch/video-watch.component.html
client/src/app/videos/+video-watch/video-watch.component.scss
server/controllers/api/videos/index.ts
server/helpers/custom-validators/videos.ts
server/initializers/constants.ts
server/initializers/migrations/0340-add-originally-published-at.ts
server/middlewares/validators/videos/videos.ts
server/models/video/video-format-utils.ts
server/models/video/video.ts
shared/models/activitypub/objects/video-torrent-object.ts
shared/models/videos/video-create.model.ts
shared/models/videos/video-update.model.ts
shared/models/videos/video.model.ts

index 11a7694c89f4bb35ff42da30484229db4c62bb89,2163eb905e9e981333941c01665958a68b63b98f..7ae13154dee7839b185e5ea3ce391959fa95c626
@@@ -82,10 -81,10 +82,11 @@@ export class VideoImportService 
        nsfw: video.nsfw,
        waitTranscoding: video.waitTranscoding,
        commentsEnabled: video.commentsEnabled,
+       downloadEnabled: video.downloadEnabled,
        thumbnailfile: video.thumbnailfile,
        previewfile: video.previewfile,
 -      scheduleUpdate
 +      scheduleUpdate,
 +      originallyPublishedAt
      }
    }
  
index 9078bb5d2889067cef453469dd223869a33285f2,18c62a1f924f1aeeffa58d23fd4f2e5b6cf15b85..c5d5bb406a1649dc5ae631748baed2cc1e28eac1
@@@ -25,9 -26,16 +26,17 @@@ export class VideoEdit implements Video
    uuid?: string
    id?: number
    scheduleUpdate?: VideoScheduleUpdate
 +  originallyPublishedAt?: Date | string
  
-   constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {
+   constructor (
+     video?: Video & {
+       tags: string[],
+       commentsEnabled: boolean,
+       downloadEnabled: boolean,
+       support: string,
+       thumbnailUrl: string,
+       previewUrl: string
+     }) {
      if (video) {
        this.id = video.id
        this.uuid = video.uuid
        tags: this.tags,
        nsfw: this.nsfw,
        commentsEnabled: this.commentsEnabled,
+       downloadEnabled: this.downloadEnabled,
        waitTranscoding: this.waitTranscoding,
        channelId: this.channelId,
 -      privacy: this.privacy
 +      privacy: this.privacy,
 +      originallyPublishedAt: this.originallyPublishedAt
      }
  
      // Special case if we scheduled an update
index 5d258891f8d74521e78d506620e1ff76bafd8d70,565aad93b7936d08106e019283a5ebc9953cc973..960846e21cf52ed4b5cc51274c1e6b2adc0a90cc
@@@ -96,10 -95,10 +96,11 @@@ export class VideoService implements Vi
        nsfw: video.nsfw,
        waitTranscoding: video.waitTranscoding,
        commentsEnabled: video.commentsEnabled,
+       downloadEnabled: video.downloadEnabled,
        thumbnailfile: video.thumbnailfile,
        previewfile: video.previewfile,
 -      scheduleUpdate
 +      scheduleUpdate,
 +      originallyPublishedAt
      }
  
      const data = objectToFormData(body)
index 2cdbc7aa685c07ef69a684861d166296d34b859c,1875230d84b6526cf4b14ac14c98453be5735ce3..6e18ab6a69724f7ccc62d4393398ab38244c79ee
              <span i18n class="video-attribute-label">Privacy</span>
              <span class="video-attribute-value">{{ video.privacy.label }}</span>
            </div>
-           <div class="video-attribute">
-             <span i18n class="video-attribute-label">Originally published on</span>
-             <span *ngIf="!video.originallyPublishedAt" class="video-attribute-value">Unknown</span>
-             <span *ngIf="video.originallyPublishedAt" class="video-attribute-value">
-                   {{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}
-           </span>
 +
++          <div *ngIf="!!video.originallyPublishedAt" class="video-attribute">
++            <span i18n class="video-attribute-label">Originally published</span>
++            <span class="video-attribute-value">{{ video.originallyPublishedAt | date: 'dd MMMM yyyy' }}</span>
 +          </div>
  
            <div class="video-attribute">
              <span i18n class="video-attribute-label">Category</span>
index f96ce8b8f903577e5732109d40dbdd3e2d04c026,b03ed197d3fe932318d1c8addf6c12c051f369ef..cfe3533b665ec38ef00b0e8f99978164452775ff
@@@ -336,10 -286,10 +286,10 @@@ $other-videos-width: 260px
        margin-bottom: 12px;
  
        .video-attribute-label {
 -        min-width: 91px;
 +        min-width: 142px;
          padding-right: 5px;
          display: inline-block;
-         color: #585858;
+         color: $grey-foreground-color;
          font-weight: $font-bold;
        }
  
index b26dcabe17cf496d19f05acec7f396163b18f3d2,76a318d13b0951282bde551b61339becd1836e6b..6ac13e6a4401ad996c25ff0b19b09844a67e57a4
@@@ -326,11 -327,7 +328,12 @@@ async function updateVideo (req: expres
        if (videoInfoToUpdate.support !== undefined) videoInstance.set('support', videoInfoToUpdate.support)
        if (videoInfoToUpdate.description !== undefined) videoInstance.set('description', videoInfoToUpdate.description)
        if (videoInfoToUpdate.commentsEnabled !== undefined) videoInstance.set('commentsEnabled', videoInfoToUpdate.commentsEnabled)
-       if (videoInfoToUpdate.originallyPublishedAt !== undefined &&
-           videoInfoToUpdate.originallyPublishedAt !== null) {
+       if (videoInfoToUpdate.downloadEnabled !== undefined) videoInstance.set('downloadEnabled', videoInfoToUpdate.downloadEnabled)
++
++      if (videoInfoToUpdate.originallyPublishedAt !== undefined && videoInfoToUpdate.originallyPublishedAt !== null) {
 +        videoInstance.set('originallyPublishedAt', videoInfoToUpdate.originallyPublishedAt)
 +      }
 +
        if (videoInfoToUpdate.privacy !== undefined) {
          const newPrivacy = parseInt(videoInfoToUpdate.privacy.toString(), 10)
          videoInstance.set('privacy', newPrivacy)
index 4a88aef87153fd471c8aec656ee10c603cd24895,639493d737333da20cef47b0c9a9602aefe63b0e..3656a23f966b2fbe245ceffce21d4df2a7faf2fd
@@@ -16,7 -16,7 +16,7 @@@ let config: IConfig = require('config'
  
  // ---------------------------------------------------------------------------
  
- const LAST_MIGRATION_VERSION = 315
 -const LAST_MIGRATION_VERSION = 335
++const LAST_MIGRATION_VERSION = 340
  
  // ---------------------------------------------------------------------------
  
index e02cca48005be67407f58a15f14a44c0c3677ae9,0000000000000000000000000000000000000000..ab8d668541adedbfaa8d7355d25b077bb78736a2
mode 100644,000000..100644
--- /dev/null
@@@ -1,42 -1,0 +1,31 @@@
-   // Sequelize does not alter the column with NOW as default value
-   {
-     const data = {
-       type: Sequelize.DATE,
-       allowNull: false,
-       defaultValue: Sequelize.NOW
-     }
-     await utils.queryInterface.changeColumn('video', 'originallyPublishedAt', data)
-   }
 +import * as Sequelize from 'sequelize'
 +
 +async function up (utils: {
 +  transaction: Sequelize.Transaction,
 +  queryInterface: Sequelize.QueryInterface,
 +  sequelize: Sequelize.Sequelize
 +}): Promise<void> {
 +
 +  {
 +    const data = {
 +      type: Sequelize.DATE,
 +      allowNull: true,
 +      defaultValue: Sequelize.NOW
 +    }
 +    await utils.queryInterface.addColumn('video', 'originallyPublishedAt', data)
 +  }
 +
 +  {
 +    const query = 'UPDATE video SET "originallyPublishedAt" = video."publishedAt"'
 +    await utils.sequelize.query(query)
 +  }
 +}
 +
 +function down (options) {
 +  throw new Error('Not implemented.')
 +}
 +
 +export {
 +  up,
 +  down
 +}
index 194d12c6e5668d242f5fcd781ff9cf810356d0c4,d9626929c649c96e88d30e2f1c4d8e428b6c143d..159727e2856d11dea05aa172e414ac27ae30f56e
@@@ -341,11 -340,11 +341,14 @@@ function getCommonVideoAttributes () 
        .optional()
        .toBoolean()
        .custom(isBooleanValid).withMessage('Should have comments enabled boolean'),
-     body('originallyPublishedAt')
+     body('downloadEnabled')
        .optional()
-       .customSanitizer(toValueOrNull)
-       .custom(isVideoOriginallyPublishedAtValid).withMessage('Should have a valid original publication date'),
+       .toBoolean()
+       .custom(isBooleanValid).withMessage('Should have downloading enabled boolean'),
 -
++    body('originallyPublishedAt')
++        .optional()
++        .customSanitizer(toValueOrNull)
++        .custom(isVideoOriginallyPublishedAtValid).withMessage('Should have a valid original publication date'),
      body('scheduleUpdate')
        .optional()
        .customSanitizer(toValueOrNull),
index 7a9513cbe5d776c21f2b49983d3854832888cfbb,76d0445d4bb5ecdc697f0b31ee7f17bb80e316b1..c63285e25ae6aafcebb331365d6159fc21005e8c
@@@ -264,10 -321,8 +322,11 @@@ function videoModelToActivityPubObject 
      waitTranscoding: video.waitTranscoding,
      state: video.state,
      commentsEnabled: video.commentsEnabled,
+     downloadEnabled: video.downloadEnabled,
      published: video.publishedAt.toISOString(),
 +    originallyPublishedAt: video.originallyPublishedAt ?
 +      video.originallyPublishedAt.toISOString() :
 +      null,
      updated: video.updatedAt.toISOString(),
      mediaType: 'text/markdown',
      content: video.getTruncatedDescription(),
Simple merge
index 392bd10258f200741e98d97740adeb2b0cbcd56e,f153a1d00bdf99eea83f910488fc30c7a04d2cb3..53631bf790b35985db6edfd36f11eec41bd410ae
@@@ -13,7 -13,7 +13,8 @@@ export interface VideoCreate 
    name: string
    tags?: string[]
    commentsEnabled?: boolean
+   downloadEnabled?: boolean
    privacy: VideoPrivacy
    scheduleUpdate?: VideoScheduleUpdate
 +  originallyPublishedAt: Date | string
  }
Simple merge