aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-07-04 11:31:22 +0200
committerChocobozzz <me@florianbigard.com>2022-07-04 11:31:22 +0200
commit0146f3516ec458d7eaba3ede2addb23005bd4a28 (patch)
tree6a7742feb5087af2d62c0478751678e93837a56f /client/src/app/shared
parentcd25344f741e8c97b113b36eb6babc7be490114d (diff)
downloadPeerTube-0146f3516ec458d7eaba3ede2addb23005bd4a28.tar.gz
PeerTube-0146f3516ec458d7eaba3ede2addb23005bd4a28.tar.zst
PeerTube-0146f3516ec458d7eaba3ede2addb23005bd4a28.zip
Fix comments/download attributes on import
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-main/video/video-edit.model.ts68
1 files changed, 32 insertions, 36 deletions
diff --git a/client/src/app/shared/shared-main/video/video-edit.model.ts b/client/src/app/shared/shared-main/video/video-edit.model.ts
index 3922ee42a..4cff01653 100644
--- a/client/src/app/shared/shared-main/video/video-edit.model.ts
+++ b/client/src/app/shared/shared-main/video/video-edit.model.ts
@@ -1,4 +1,6 @@
1import { Video, VideoPrivacy, VideoScheduleUpdate, VideoUpdate } from '@shared/models' 1import { getAbsoluteAPIUrl } from '@app/helpers'
2import { VideoPrivacy, VideoScheduleUpdate, VideoUpdate } from '@shared/models'
3import { VideoDetails } from './video-details.model'
2 4
3export class VideoEdit implements VideoUpdate { 5export class VideoEdit implements VideoUpdate {
4 static readonly SPECIAL_SCHEDULED_PRIVACY = -1 6 static readonly SPECIAL_SCHEDULED_PRIVACY = -1
@@ -29,40 +31,34 @@ export class VideoEdit implements VideoUpdate {
29 31
30 pluginData?: any 32 pluginData?: any
31 33
32 constructor ( 34 constructor (video?: VideoDetails) {
33 video?: Video & { 35 if (!video) return
34 tags: string[] 36
35 commentsEnabled: boolean 37 this.id = video.id
36 downloadEnabled: boolean 38 this.uuid = video.uuid
37 support: string 39 this.shortUUID = video.shortUUID
38 thumbnailUrl: string 40 this.category = video.category.id
39 previewUrl: string 41 this.licence = video.licence.id
40 }) { 42 this.language = video.language.id
41 if (video) { 43 this.description = video.description
42 this.id = video.id 44 this.name = video.name
43 this.uuid = video.uuid 45 this.tags = video.tags
44 this.shortUUID = video.shortUUID 46 this.nsfw = video.nsfw
45 this.category = video.category.id 47 this.waitTranscoding = video.waitTranscoding
46 this.licence = video.licence.id 48 this.channelId = video.channel.id
47 this.language = video.language.id 49 this.privacy = video.privacy.id
48 this.description = video.description 50 this.commentsEnabled = video.commentsEnabled
49 this.name = video.name 51 this.downloadEnabled = video.downloadEnabled
50 this.tags = video.tags 52
51 this.nsfw = video.nsfw 53 if (video.thumbnailPath) this.thumbnailUrl = getAbsoluteAPIUrl() + video.thumbnailPath
52 this.commentsEnabled = video.commentsEnabled 54 if (video.previewPath) this.previewUrl = getAbsoluteAPIUrl() + video.previewPath
53 this.downloadEnabled = video.downloadEnabled 55
54 this.waitTranscoding = video.waitTranscoding 56 this.scheduleUpdate = video.scheduledUpdate
55 this.channelId = video.channel.id 57 this.originallyPublishedAt = video.originallyPublishedAt
56 this.privacy = video.privacy.id 58 ? new Date(video.originallyPublishedAt)
57 this.support = video.support 59 : null
58 this.thumbnailUrl = video.thumbnailUrl 60
59 this.previewUrl = video.previewUrl 61 this.pluginData = video.pluginData
60
61 this.scheduleUpdate = video.scheduledUpdate
62 this.originallyPublishedAt = video.originallyPublishedAt ? new Date(video.originallyPublishedAt) : null
63
64 this.pluginData = video.pluginData
65 }
66 } 62 }
67 63
68 patch (values: { [ id: string ]: any }) { 64 patch (values: { [ id: string ]: any }) {
@@ -86,7 +82,7 @@ export class VideoEdit implements VideoUpdate {
86 82
87 // Convert originallyPublishedAt to string so that function objectToFormData() works correctly 83 // Convert originallyPublishedAt to string so that function objectToFormData() works correctly
88 if (this.originallyPublishedAt) { 84 if (this.originallyPublishedAt) {
89 const originallyPublishedAt = new Date(values['originallyPublishedAt']) 85 const originallyPublishedAt = new Date(this.originallyPublishedAt)
90 this.originallyPublishedAt = originallyPublishedAt.toISOString() 86 this.originallyPublishedAt = originallyPublishedAt.toISOString()
91 } 87 }
92 88