From 7f2cfe3a792856f7de6f1d13688aa3d06ec1bf70 Mon Sep 17 00:00:00 2001 From: Lucas Declercq Date: Mon, 8 Oct 2018 14:45:22 +0200 Subject: [PATCH] Rename downloadingEnabled property to downloadEnabled --- .../app/shared/video-import/video-import.service.ts | 2 +- client/src/app/shared/video/video-details.model.ts | 4 ++-- client/src/app/shared/video/video-edit.model.ts | 8 ++++---- client/src/app/shared/video/video.service.ts | 2 +- .../+video-edit/shared/video-edit.component.html | 2 +- .../+video-edit/shared/video-edit.component.ts | 4 ++-- .../video-import-torrent.component.ts | 4 ++-- .../video-import-url.component.ts | 4 ++-- .../video-add-components/video-upload.component.ts | 4 ++-- .../app/videos/+video-watch/video-watch.component.ts | 2 +- server/controllers/api/videos/import.ts | 2 +- server/controllers/api/videos/index.ts | 4 ++-- server/helpers/activitypub.ts | 2 +- server/helpers/audit-logger.ts | 2 +- .../helpers/custom-validators/activitypub/videos.ts | 4 ++-- .../migrations/0280-video-downloading-enabled.ts | 4 ++-- server/lib/activitypub/videos.ts | 4 ++-- server/middlewares/validators/videos/videos.ts | 2 +- server/models/video/video-format-utils.ts | 4 ++-- server/models/video/video.ts | 2 +- server/tests/api/check-params/video-imports.ts | 2 +- server/tests/api/check-params/videos.ts | 4 ++-- server/tests/api/server/follows.ts | 2 +- server/tests/api/server/handle-down.ts | 2 +- server/tests/api/videos/multiple-servers.ts | 12 ++++++------ server/tests/api/videos/single-server.ts | 6 +++--- server/tests/utils/videos/videos.ts | 12 ++++++------ server/tools/peertube-import-videos.ts | 2 +- server/tools/peertube-upload.ts | 4 ++-- .../activitypub/objects/video-torrent-object.ts | 2 +- shared/models/videos/video-create.model.ts | 2 +- shared/models/videos/video-update.model.ts | 2 +- shared/models/videos/video.model.ts | 2 +- support/doc/api/openapi.yaml | 4 ++-- support/doc/api/videos.yaml | 4 ++-- 35 files changed, 64 insertions(+), 64 deletions(-) diff --git a/client/src/app/shared/video-import/video-import.service.ts b/client/src/app/shared/video-import/video-import.service.ts index 74c458645..2163eb905 100644 --- a/client/src/app/shared/video-import/video-import.service.ts +++ b/client/src/app/shared/video-import/video-import.service.ts @@ -81,7 +81,7 @@ export class VideoImportService { nsfw: video.nsfw, waitTranscoding: video.waitTranscoding, commentsEnabled: video.commentsEnabled, - downloadingEnabled: video.downloadingEnabled, + downloadEnabled: video.downloadEnabled, thumbnailfile: video.thumbnailfile, previewfile: video.previewfile, scheduleUpdate diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts index ad85641dc..5ff3926c4 100644 --- a/client/src/app/shared/video/video-details.model.ts +++ b/client/src/app/shared/video/video-details.model.ts @@ -12,7 +12,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { files: VideoFile[] account: Account commentsEnabled: boolean - downloadingEnabled: boolean + downloadEnabled: boolean waitTranscoding: boolean state: VideoConstant @@ -30,7 +30,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel { this.tags = hash.tags this.support = hash.support this.commentsEnabled = hash.commentsEnabled - this.downloadingEnabled = hash.downloadingEnabled + this.downloadEnabled = hash.downloadEnabled this.buildLikeAndDislikePercents() } diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts index 47703ff79..e385004e5 100644 --- a/client/src/app/shared/video/video-edit.model.ts +++ b/client/src/app/shared/video/video-edit.model.ts @@ -14,7 +14,7 @@ export class VideoEdit implements VideoUpdate { tags: string[] nsfw: boolean commentsEnabled: boolean - downloadingEnabled: boolean + downloadEnabled: boolean waitTranscoding: boolean channelId: number privacy: VideoPrivacy @@ -27,7 +27,7 @@ export class VideoEdit implements VideoUpdate { id?: number scheduleUpdate?: VideoScheduleUpdate - constructor (video?: Video & { tags: string[], commentsEnabled: boolean, downloadingEnabled: 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 @@ -39,7 +39,7 @@ export class VideoEdit implements VideoUpdate { this.tags = video.tags this.nsfw = video.nsfw this.commentsEnabled = video.commentsEnabled - this.downloadingEnabled = video.downloadingEnabled + this.downloadEnabled = video.downloadEnabled this.waitTranscoding = video.waitTranscoding this.channelId = video.channel.id this.privacy = video.privacy.id @@ -82,7 +82,7 @@ export class VideoEdit implements VideoUpdate { tags: this.tags, nsfw: this.nsfw, commentsEnabled: this.commentsEnabled, - downloadingEnabled: this.downloadingEnabled, + downloadEnabled: this.downloadEnabled, waitTranscoding: this.waitTranscoding, channelId: this.channelId, privacy: this.privacy diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts index c0339dd39..c9d6da7a4 100644 --- a/client/src/app/shared/video/video.service.ts +++ b/client/src/app/shared/video/video.service.ts @@ -95,7 +95,7 @@ export class VideoService implements VideosProvider { nsfw: video.nsfw, waitTranscoding: video.waitTranscoding, commentsEnabled: video.commentsEnabled, - downloadingEnabled: video.downloadingEnabled, + downloadEnabled: video.downloadEnabled, thumbnailfile: video.thumbnailfile, previewfile: video.previewfile, scheduleUpdate diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.html b/client/src/app/videos/+video-edit/shared/video-edit.component.html index 70d535055..8c74a1ca6 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.html @@ -126,7 +126,7 @@ > 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 b09664376..1dae931e2 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 @@ -80,7 +80,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { const defaultValues = { nsfw: 'false', commentsEnabled: 'true', - downloadingEnabled: 'true', + downloadEnabled: 'true', waitTranscoding: 'true', tags: [] } @@ -90,7 +90,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { channelId: this.videoValidatorsService.VIDEO_CHANNEL, nsfw: null, commentsEnabled: null, - downloadingEnabled: null, + downloadEnabled: null, waitTranscoding: null, category: this.videoValidatorsService.VIDEO_CATEGORY, licence: this.videoValidatorsService.VIDEO_LICENCE, diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 57cf0e395..0f6fd17a9 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts @@ -77,7 +77,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca privacy: this.firstStepPrivacyId, waitTranscoding: false, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, channelId: this.firstStepChannelId } @@ -92,7 +92,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca this.video = new VideoEdit(Object.assign(res.video, { commentsEnabled: videoUpdate.commentsEnabled, - downloadingEnabled: videoUpdate.downloadingEnabled, + downloadEnabled: videoUpdate.downloadEnabled, support: null, thumbnailUrl: null, previewUrl: null diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 11db4a7ef..fbc85c74f 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts @@ -69,7 +69,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom privacy: this.firstStepPrivacyId, waitTranscoding: false, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, channelId: this.firstStepChannelId } @@ -84,7 +84,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom this.video = new VideoEdit(Object.assign(res.video, { commentsEnabled: videoUpdate.commentsEnabled, - downloadingEnabled: videoUpdate.downloadingEnabled, + downloadEnabled: videoUpdate.downloadEnabled, support: null, thumbnailUrl: null, previewUrl: null 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 53f72f4e6..ac6c1786f 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 @@ -159,7 +159,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy const nsfw = false const waitTranscoding = true const commentsEnabled = true - const downloadingEnabled = true + const downloadEnabled = true const channelId = this.firstStepChannelId.toString() const formData = new FormData() @@ -168,7 +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('downloadEnabled', '' + downloadEnabled) formData.append('waitTranscoding', '' + waitTranscoding) formData.append('channelId', '' + channelId) formData.append('videofile', videofile) diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index 7cc831ab1..a7fd45695 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -314,7 +314,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } isVideoDownloadable () { - return this.video && this.video.downloadingEnabled + return this.video && this.video.downloadEnabled } isVideoToImport () { diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index a5cddba89..9e51e2000 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -171,7 +171,7 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You licence: body.licence || importData.licence, language: body.language || undefined, commentsEnabled: body.commentsEnabled || true, - downloadingEnabled: body.downloadingEnabled || true, + downloadEnabled: body.downloadEnabled || true, waitTranscoding: body.waitTranscoding || false, state: VideoState.TO_IMPORT, nsfw: body.nsfw || importData.nsfw || false, diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 4b6d1b847..7d55f06b6 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts @@ -179,7 +179,7 @@ async function addVideo (req: express.Request, res: express.Response) { licence: videoInfo.licence, language: videoInfo.language, commentsEnabled: videoInfo.commentsEnabled || false, - downloadingEnabled: videoInfo.downloadingEnabled || true, + downloadEnabled: videoInfo.downloadEnabled || true, waitTranscoding: videoInfo.waitTranscoding || false, state: CONFIG.TRANSCODING.ENABLED ? VideoState.TO_TRANSCODE : VideoState.PUBLISHED, nsfw: videoInfo.nsfw || false, @@ -323,7 +323,7 @@ async function updateVideo (req: express.Request, res: express.Response) { 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.downloadingEnabled !== undefined) videoInstance.set('downloadingEnabled', videoInfoToUpdate.downloadingEnabled) + if (videoInfoToUpdate.downloadEnabled !== undefined) videoInstance.set('downloadEnabled', videoInfoToUpdate.downloadEnabled) if (videoInfoToUpdate.privacy !== undefined) { const newPrivacy = parseInt(videoInfoToUpdate.privacy.toString(), 10) videoInstance.set('privacy', newPrivacy) diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts index 7f903e486..2469b37b1 100644 --- a/server/helpers/activitypub.ts +++ b/server/helpers/activitypub.ts @@ -28,7 +28,7 @@ function activityPubContextify (data: T) { size: 'schema:Number', fps: 'schema:Number', commentsEnabled: 'schema:Boolean', - downloadingEnabled: 'schema:Boolean', + downloadEnabled: 'schema:Boolean', waitTranscoding: 'schema:Boolean', expires: 'schema:expires', support: 'schema:Text', diff --git a/server/helpers/audit-logger.ts b/server/helpers/audit-logger.ts index d2c9aee01..a121f0b8a 100644 --- a/server/helpers/audit-logger.ts +++ b/server/helpers/audit-logger.ts @@ -118,7 +118,7 @@ const videoKeysToKeep = [ 'channel-name', 'support', 'commentsEnabled', - 'downloadingEnabled' + 'downloadEnabled' ] class VideoAuditView extends EntityAuditView { constructor (private video: VideoDetails) { diff --git a/server/helpers/custom-validators/activitypub/videos.ts b/server/helpers/custom-validators/activitypub/videos.ts index 59964f91a..5015c59dd 100644 --- a/server/helpers/custom-validators/activitypub/videos.ts +++ b/server/helpers/custom-validators/activitypub/videos.ts @@ -56,7 +56,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { // Default attributes if (!isVideoStateValid(video.state)) video.state = VideoState.PUBLISHED if (!isBooleanValid(video.waitTranscoding)) video.waitTranscoding = false - if (!isBooleanValid(video.downloadingEnabled)) video.downloadingEnabled = true + if (!isBooleanValid(video.downloadEnabled)) video.downloadEnabled = true return isActivityPubUrlValid(video.id) && isVideoNameValid(video.name) && @@ -68,7 +68,7 @@ function sanitizeAndCheckVideoTorrentObject (video: any) { isVideoViewsValid(video.views) && isBooleanValid(video.sensitive) && isBooleanValid(video.commentsEnabled) && - isBooleanValid(video.downloadingEnabled) && + isBooleanValid(video.downloadEnabled) && isDateValid(video.published) && isDateValid(video.updated) && (!video.content || isRemoteVideoContentValid(video.mediaType, video.content)) && diff --git a/server/initializers/migrations/0280-video-downloading-enabled.ts b/server/initializers/migrations/0280-video-downloading-enabled.ts index c0700108c..e79466447 100644 --- a/server/initializers/migrations/0280-video-downloading-enabled.ts +++ b/server/initializers/migrations/0280-video-downloading-enabled.ts @@ -11,10 +11,10 @@ async function up (utils: { allowNull: false, defaultValue: true } as Migration.Boolean - await utils.queryInterface.addColumn('video', 'downloadingEnabled', data) + await utils.queryInterface.addColumn('video', 'downloadEnabled', data) data.defaultValue = null - return utils.queryInterface.changeColumn('video', 'downloadingEnabled', data) + return utils.queryInterface.changeColumn('video', 'downloadEnabled', data) } function down (options) { diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index dd02141ee..8521572a1 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts @@ -230,7 +230,7 @@ async function updateVideoFromAP (options: { options.video.set('support', videoData.support) options.video.set('nsfw', videoData.nsfw) options.video.set('commentsEnabled', videoData.commentsEnabled) - options.video.set('downloadingEnabled', videoData.downloadingEnabled) + options.video.set('downloadEnabled', videoData.downloadEnabled) options.video.set('waitTranscoding', videoData.waitTranscoding) options.video.set('state', videoData.state) options.video.set('duration', videoData.duration) @@ -442,7 +442,7 @@ async function videoActivityObjectToDBAttributes ( support, nsfw: videoObject.sensitive, commentsEnabled: videoObject.commentsEnabled, - downloadingEnabled: videoObject.downloadingEnabled, + downloadEnabled: videoObject.downloadEnabled, waitTranscoding: videoObject.waitTranscoding, state: videoObject.state, channelId: videoChannel.id, diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index bdba87496..27e8a7449 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts @@ -349,7 +349,7 @@ function getCommonVideoAttributes () { .optional() .toBoolean() .custom(isBooleanValid).withMessage('Should have comments enabled boolean'), - body('downloadingEnabled') + body('downloadEnabled') .optional() .toBoolean() .custom(isBooleanValid).withMessage('Should have downloading enabled boolean'), diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index 0b0da4181..e7bff2ed7 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -128,7 +128,7 @@ function videoModelToFormattedDetailsJSON (video: VideoModel): VideoDetails { account: video.VideoChannel.Account.toFormattedJSON(), tags, commentsEnabled: video.commentsEnabled, - downloadingEnabled: video.downloadingEnabled, + downloadEnabled: video.downloadEnabled, waitTranscoding: video.waitTranscoding, state: { id: video.state, @@ -260,7 +260,7 @@ function videoModelToActivityPubObject (video: VideoModel): VideoTorrentObject { waitTranscoding: video.waitTranscoding, state: video.state, commentsEnabled: video.commentsEnabled, - downloadingEnabled: video.downloadingEnabled, + downloadEnabled: video.downloadEnabled, published: video.publishedAt.toISOString(), updated: video.updatedAt.toISOString(), mediaType: 'text/markdown', diff --git a/server/models/video/video.ts b/server/models/video/video.ts index a2fe53fb9..a9baaf1da 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -600,7 +600,7 @@ export class VideoModel extends Model { @AllowNull(false) @Column - downloadingEnabled: boolean + downloadEnabled: boolean @AllowNull(false) @Column diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 8dd87b8ae..1ffb81a38 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts @@ -84,7 +84,7 @@ describe('Test video imports API validator', function () { language: 'pt', nsfw: false, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, waitTranscoding: true, description: 'my super description', support: 'my super support text', diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index c5740087c..bc28e2422 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -175,7 +175,7 @@ describe('Test videos API validator', function () { language: 'pt', nsfw: false, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, waitTranscoding: true, description: 'my super description', support: 'my super support text', @@ -420,7 +420,7 @@ describe('Test videos API validator', function () { language: 'pt', nsfw: false, commentsEnabled: false, - downloadingEnabled: false, + downloadEnabled: false, description: 'my super description', privacy: VideoPrivacy.PUBLIC, tags: [ 'tag1', 'tag2' ] diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 5cad1d09d..e8914a9d4 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts @@ -305,7 +305,7 @@ describe('Test follows', function () { }, isLocal, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, duration: 5, tags: [ 'tag1', 'tag2', 'tag3' ], privacy: VideoPrivacy.PUBLIC, diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 971de4607..b0a3d029a 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts @@ -70,7 +70,7 @@ describe('Test handle downs', function () { tags: [ 'tag1p1', 'tag2p1' ], privacy: VideoPrivacy.PUBLIC, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, channel: { name: 'root_channel', displayName: 'Main root channel', diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 83e391ccd..256be5d1c 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -127,7 +127,7 @@ describe('Test multiple servers', function () { tags: [ 'tag1p1', 'tag2p1' ], privacy: VideoPrivacy.PUBLIC, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, channel: { displayName: 'my channel', name: 'super_channel_name', @@ -199,7 +199,7 @@ describe('Test multiple servers', function () { }, isLocal, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, duration: 5, tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], privacy: VideoPrivacy.PUBLIC, @@ -308,7 +308,7 @@ describe('Test multiple servers', function () { isLocal, duration: 5, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, tags: [ 'tag1p3' ], privacy: VideoPrivacy.PUBLIC, channel: { @@ -340,7 +340,7 @@ describe('Test multiple servers', function () { host: 'localhost:9003' }, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, isLocal, duration: 5, tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], @@ -658,7 +658,7 @@ describe('Test multiple servers', function () { isLocal, duration: 5, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, tags: [ 'tag_up_1', 'tag_up_2' ], privacy: VideoPrivacy.PUBLIC, channel: { @@ -980,7 +980,7 @@ describe('Test multiple servers', function () { isLocal, duration: 5, commentsEnabled: false, - downloadingEnabled: false, + downloadEnabled: false, tags: [ ], privacy: VideoPrivacy.PUBLIC, channel: { diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index 8995a8525..92d42eb80 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -55,7 +55,7 @@ describe('Test a single server', function () { tags: [ 'tag1', 'tag2', 'tag3' ], privacy: VideoPrivacy.PUBLIC, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, channel: { displayName: 'Main root channel', name: 'root_channel', @@ -88,7 +88,7 @@ describe('Test a single server', function () { privacy: VideoPrivacy.PUBLIC, duration: 5, commentsEnabled: false, - downloadingEnabled: false, + downloadEnabled: false, channel: { name: 'root_channel', displayName: 'Main root channel', @@ -358,7 +358,7 @@ describe('Test a single server', function () { nsfw: false, description: 'my super description updated', commentsEnabled: false, - downloadingEnabled: false, + downloadEnabled: false, tags: [ 'tagup1', 'tagup2' ] } await updateVideo(server.url, server.accessToken, videoId, attributes) diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index a7fd4c8a6..bc878b039 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -27,7 +27,7 @@ type VideoAttributes = { language?: string nsfw?: boolean commentsEnabled?: boolean - downloadingEnabled?: boolean + downloadEnabled?: boolean waitTranscoding?: boolean description?: string tags?: string[] @@ -311,7 +311,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg tags: [ 'tag' ], privacy: VideoPrivacy.PUBLIC, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, fixture: 'video_short.webm' }, videoAttributesArg) @@ -322,7 +322,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg .field('name', attributes.name) .field('nsfw', JSON.stringify(attributes.nsfw)) .field('commentsEnabled', JSON.stringify(attributes.commentsEnabled)) - .field('downloadingEnabled', JSON.stringify(attributes.downloadingEnabled)) + .field('downloadEnabled', JSON.stringify(attributes.downloadEnabled)) .field('waitTranscoding', JSON.stringify(attributes.waitTranscoding)) .field('privacy', attributes.privacy.toString()) .field('channelId', attributes.channelId) @@ -373,7 +373,7 @@ function updateVideo (url: string, accessToken: string, id: number | string, att if (attributes.language) body['language'] = attributes.language if (attributes.nsfw !== undefined) body['nsfw'] = JSON.stringify(attributes.nsfw) if (attributes.commentsEnabled !== undefined) body['commentsEnabled'] = JSON.stringify(attributes.commentsEnabled) - if (attributes.downloadingEnabled !== undefined) body['downloadingEnabled'] = JSON.stringify(attributes.downloadingEnabled) + if (attributes.downloadEnabled !== undefined) body['downloadEnabled'] = JSON.stringify(attributes.downloadEnabled) if (attributes.description) body['description'] = attributes.description if (attributes.tags) body['tags'] = attributes.tags if (attributes.privacy) body['privacy'] = attributes.privacy @@ -439,7 +439,7 @@ async function completeVideoCheck ( language: string nsfw: boolean commentsEnabled: boolean - downloadingEnabled: boolean + downloadEnabled: boolean description: string publishedAt?: string support: string @@ -514,7 +514,7 @@ async function completeVideoCheck ( expect(dateIsValid(videoDetails.channel.createdAt.toString())).to.be.true expect(dateIsValid(videoDetails.channel.updatedAt.toString())).to.be.true expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled) - expect(videoDetails.downloadingEnabled).to.equal(attributes.downloadingEnabled) + expect(videoDetails.downloadEnabled).to.equal(attributes.downloadEnabled) for (const attributeFile of attributes.files) { const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution) diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 675c621df..15f517cab 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -212,7 +212,7 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, cwd: st nsfw: isNSFW(videoInfo), waitTranscoding: true, commentsEnabled: true, - downloadingEnabled: true, + downloadEnabled: true, description: videoInfo.description || undefined, support: undefined, tags, diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts index e2ba4bdbc..b17bc4288 100644 --- a/server/tools/peertube-upload.ts +++ b/server/tools/peertube-upload.ts @@ -30,7 +30,7 @@ if (!program['tags']) program['tags'] = [] if (!program['nsfw']) program['nsfw'] = false if (!program['privacy']) program['privacy'] = VideoPrivacy.PUBLIC if (!program['commentsEnabled']) program['commentsEnabled'] = false -if (!program['downloadingEnabled']) program['downloadingEnabled'] = true +if (!program['downloadEnabled']) program['downloadEnabled'] = true getSettings() .then(settings => { @@ -117,7 +117,7 @@ async function run () { description: program['videoDescription'], tags: program['tags'], commentsEnabled: program['commentsEnabled'], - downloadingEnabled: program['downloadingEnabled'], + downloadEnabled: program['downloadEnabled'], fixture: program['file'], thumbnailfile: program['thumbnail'], previewfile: program['preview'], diff --git a/shared/models/activitypub/objects/video-torrent-object.ts b/shared/models/activitypub/objects/video-torrent-object.ts index beb2f519e..4231fbb68 100644 --- a/shared/models/activitypub/objects/video-torrent-object.ts +++ b/shared/models/activitypub/objects/video-torrent-object.ts @@ -21,7 +21,7 @@ export interface VideoTorrentObject { views: number sensitive: boolean commentsEnabled: boolean, - downloadingEnabled: boolean, + downloadEnabled: boolean, waitTranscoding: boolean state: VideoState published: string diff --git a/shared/models/videos/video-create.model.ts b/shared/models/videos/video-create.model.ts index 6e5e03e0a..f153a1d00 100644 --- a/shared/models/videos/video-create.model.ts +++ b/shared/models/videos/video-create.model.ts @@ -13,7 +13,7 @@ export interface VideoCreate { name: string tags?: string[] commentsEnabled?: boolean - downloadingEnabled?: boolean + downloadEnabled?: boolean privacy: VideoPrivacy scheduleUpdate?: VideoScheduleUpdate } diff --git a/shared/models/videos/video-update.model.ts b/shared/models/videos/video-update.model.ts index bf7a9af37..6f96633ae 100644 --- a/shared/models/videos/video-update.model.ts +++ b/shared/models/videos/video-update.model.ts @@ -11,7 +11,7 @@ export interface VideoUpdate { privacy?: VideoPrivacy tags?: string[] commentsEnabled?: boolean - downloadingEnabled?: boolean + downloadEnabled?: boolean nsfw?: boolean waitTranscoding?: boolean channelId?: number diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts index 783cd86e5..4a792fcbc 100644 --- a/shared/models/videos/video.model.ts +++ b/shared/models/videos/video.model.ts @@ -82,7 +82,7 @@ export interface VideoDetails extends Video { files: VideoFile[] account: Account commentsEnabled: boolean - downloadingEnabled: boolean + downloadEnabled: boolean // Not optional in details (unlike in Video) waitTranscoding: boolean diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index 9ce24c0ed..8ff81d317 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml @@ -536,7 +536,7 @@ paths: - $ref: "videos.yaml#/parameters/name" - $ref: "videos.yaml#/parameters/tags" - $ref: "videos.yaml#/parameters/commentsEnabled" - - $ref: "videos.yaml#/parameters/downloadingEnabled" + - $ref: "videos.yaml#/parameters/downloadEnabled" - $ref: "videos.yaml#/parameters/privacy" - $ref: "videos.yaml#/parameters/scheduleUpdate" responses: @@ -633,7 +633,7 @@ paths: - $ref: "videos.yaml#/parameters/name" - $ref: "videos.yaml#/parameters/tags" - $ref: "videos.yaml#/parameters/commentsEnabled" - - $ref: "videos.yaml#/parameters/downloadingEnabled" + - $ref: "videos.yaml#/parameters/downloadEnabled" - $ref: "videos.yaml#/parameters/privacy" - $ref: "videos.yaml#/parameters/scheduleUpdate" responses: diff --git a/support/doc/api/videos.yaml b/support/doc/api/videos.yaml index 93aa26285..0c611e3a8 100644 --- a/support/doc/api/videos.yaml +++ b/support/doc/api/videos.yaml @@ -65,8 +65,8 @@ parameters: in: formData type: boolean description: 'Enable or disable comments for this video' - downloadingEnabled: - name: downloadingEnabled + downloadEnabled: + name: downloadEnabled in: formData type: boolean description: 'Enable or disable downloading for this video' -- 2.41.0