diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-28 10:18:37 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-28 10:18:37 +0200 |
commit | c39e86b898370a55c147ed1958db00723b0364e4 (patch) | |
tree | 4a3e1dcdc7a061d9d86fd27bd76492a783b4172b /server/models/video | |
parent | 161b061d4e51eb1e2b2b7e9482d5299489ef7c45 (diff) | |
download | PeerTube-c39e86b898370a55c147ed1958db00723b0364e4.tar.gz PeerTube-c39e86b898370a55c147ed1958db00723b0364e4.tar.zst PeerTube-c39e86b898370a55c147ed1958db00723b0364e4.zip |
Fix video description when importing by url
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-format-utils.ts | 3 | ||||
-rw-r--r-- | server/models/video/video-import.ts | 5 |
2 files changed, 4 insertions, 4 deletions
diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index a9a58624d..18364a287 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts | |||
@@ -12,6 +12,7 @@ import { | |||
12 | } from '../../lib/activitypub' | 12 | } from '../../lib/activitypub' |
13 | 13 | ||
14 | export type VideoFormattingJSONOptions = { | 14 | export type VideoFormattingJSONOptions = { |
15 | completeDescription?: boolean | ||
15 | additionalAttributes: { | 16 | additionalAttributes: { |
16 | state?: boolean, | 17 | state?: boolean, |
17 | waitTranscoding?: boolean, | 18 | waitTranscoding?: boolean, |
@@ -44,7 +45,7 @@ function videoModelToFormattedJSON (video: VideoModel, options?: VideoFormatting | |||
44 | label: VideoModel.getPrivacyLabel(video.privacy) | 45 | label: VideoModel.getPrivacyLabel(video.privacy) |
45 | }, | 46 | }, |
46 | nsfw: video.nsfw, | 47 | nsfw: video.nsfw, |
47 | description: video.getTruncatedDescription(), | 48 | description: options.completeDescription === true ? video.description : video.getTruncatedDescription(), |
48 | isLocal: video.isOwned(), | 49 | isLocal: video.isOwned(), |
49 | duration: video.duration, | 50 | duration: video.duration, |
50 | views: video.views, | 51 | views: video.views, |
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts index 9d1f783c7..8d442b3f8 100644 --- a/server/models/video/video-import.ts +++ b/server/models/video/video-import.ts | |||
@@ -146,12 +146,11 @@ export class VideoImportModel extends Model<VideoImportModel> { | |||
146 | 146 | ||
147 | toFormattedJSON (): VideoImport { | 147 | toFormattedJSON (): VideoImport { |
148 | const videoFormatOptions = { | 148 | const videoFormatOptions = { |
149 | completeDescription: true, | ||
149 | additionalAttributes: { state: true, waitTranscoding: true, scheduledUpdate: true } | 150 | additionalAttributes: { state: true, waitTranscoding: true, scheduledUpdate: true } |
150 | } | 151 | } |
151 | const video = this.Video | 152 | const video = this.Video |
152 | ? Object.assign(this.Video.toFormattedJSON(videoFormatOptions), { | 153 | ? Object.assign(this.Video.toFormattedJSON(videoFormatOptions), { tags: this.Video.Tags.map(t => t.name) }) |
153 | tags: this.Video.Tags.map(t => t.name) | ||
154 | }) | ||
155 | : undefined | 154 | : undefined |
156 | 155 | ||
157 | return { | 156 | return { |