aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorclementbrizard <clementbrizard53@gmail.com>2019-01-12 13:41:45 +0000
committerclementbrizard <clementbrizard53@gmail.com>2019-01-12 13:41:45 +0000
commitc80341655fce5e70ad6da7d812e2ddeb1f8ef7f2 (patch)
tree9f0415756552c5e4d4b18aee50bccbfaa75dd4c3 /client/src/app
parent94a680c095b3007179820ac091189f639dd39e6b (diff)
downloadPeerTube-c80341655fce5e70ad6da7d812e2ddeb1f8ef7f2.tar.gz
PeerTube-c80341655fce5e70ad6da7d812e2ddeb1f8ef7f2.tar.zst
PeerTube-c80341655fce5e70ad6da7d812e2ddeb1f8ef7f2.zip
Change models
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/shared/video/video-edit.model.ts11
-rw-r--r--client/src/app/shared/video/video.model.ts4
2 files changed, 14 insertions, 1 deletions
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts
index fc772a3cf..9078bb5d2 100644
--- a/client/src/app/shared/video/video-edit.model.ts
+++ b/client/src/app/shared/video/video-edit.model.ts
@@ -25,6 +25,7 @@ export class VideoEdit implements VideoUpdate {
25 uuid?: string 25 uuid?: string
26 id?: number 26 id?: number
27 scheduleUpdate?: VideoScheduleUpdate 27 scheduleUpdate?: VideoScheduleUpdate
28 originallyPublishedAt?: Date | string
28 29
29 constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) { 30 constructor (video?: Video & { tags: string[], commentsEnabled: boolean, support: string, thumbnailUrl: string, previewUrl: string }) {
30 if (video) { 31 if (video) {
@@ -46,6 +47,7 @@ export class VideoEdit implements VideoUpdate {
46 this.previewUrl = video.previewUrl 47 this.previewUrl = video.previewUrl
47 48
48 this.scheduleUpdate = video.scheduledUpdate 49 this.scheduleUpdate = video.scheduledUpdate
50 this.originallyPublishedAt = new Date(video.originallyPublishedAt)
49 } 51 }
50 } 52 }
51 53
@@ -67,6 +69,12 @@ export class VideoEdit implements VideoUpdate {
67 } else { 69 } else {
68 this.scheduleUpdate = null 70 this.scheduleUpdate = null
69 } 71 }
72
73 // Convert originallyPublishedAt to string so that function objectToFormData() works correctly
74 if (this.originallyPublishedAt) {
75 const originallyPublishedAt = new Date(values['originallyPublishedAt'])
76 this.originallyPublishedAt = originallyPublishedAt.toISOString()
77 }
70 } 78 }
71 79
72 toFormPatch () { 80 toFormPatch () {
@@ -82,7 +90,8 @@ export class VideoEdit implements VideoUpdate {
82 commentsEnabled: this.commentsEnabled, 90 commentsEnabled: this.commentsEnabled,
83 waitTranscoding: this.waitTranscoding, 91 waitTranscoding: this.waitTranscoding,
84 channelId: this.channelId, 92 channelId: this.channelId,
85 privacy: this.privacy 93 privacy: this.privacy,
94 originallyPublishedAt: this.originallyPublishedAt
86 } 95 }
87 96
88 // Special case if we scheduled an update 97 // Special case if we scheduled an update
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts
index b92c96450..c9b052951 100644
--- a/client/src/app/shared/video/video.model.ts
+++ b/client/src/app/shared/video/video.model.ts
@@ -17,6 +17,7 @@ export class Video implements VideoServerModel {
17 createdAt: Date 17 createdAt: Date
18 updatedAt: Date 18 updatedAt: Date
19 publishedAt: Date 19 publishedAt: Date
20 originallyPublishedAt: Date | string
20 category: VideoConstant<number> 21 category: VideoConstant<number>
21 licence: VideoConstant<number> 22 licence: VideoConstant<number>
22 language: VideoConstant<string> 23 language: VideoConstant<string>
@@ -116,6 +117,9 @@ export class Video implements VideoServerModel {
116 this.privacy.label = peertubeTranslate(this.privacy.label, translations) 117 this.privacy.label = peertubeTranslate(this.privacy.label, translations)
117 118
118 this.scheduledUpdate = hash.scheduledUpdate 119 this.scheduledUpdate = hash.scheduledUpdate
120 this.originallyPublishedAt = hash.originallyPublishedAt ?
121 new Date(hash.originallyPublishedAt.toString())
122 : null
119 if (this.state) this.state.label = peertubeTranslate(this.state.label, translations) 123 if (this.state) this.state.label = peertubeTranslate(this.state.label, translations)
120 124
121 this.blacklisted = hash.blacklisted 125 this.blacklisted = hash.blacklisted