From 0f320037e689b2778959c12ddd4ce790f6e4ae4f Mon Sep 17 00:00:00 2001
From: Chocobozzz <me@florianbigard.com>
Date: Fri, 11 May 2018 15:10:13 +0200
Subject: Add ability to update a video channel

---
 client/src/app/shared/actor/actor.model.ts      |  6 +++---
 client/src/app/shared/video/video-edit.model.ts |  6 +++---
 client/src/app/shared/video/video.model.ts      | 10 ++++++++++
 client/src/app/shared/video/video.service.ts    |  1 +
 4 files changed, 17 insertions(+), 6 deletions(-)

(limited to 'client/src/app/shared')

diff --git a/client/src/app/shared/actor/actor.model.ts b/client/src/app/shared/actor/actor.model.ts
index 56ff780b7..37d84cb6e 100644
--- a/client/src/app/shared/actor/actor.model.ts
+++ b/client/src/app/shared/actor/actor.model.ts
@@ -1,6 +1,6 @@
 import { Actor as ActorServer } from '../../../../../shared/models/actors/actor.model'
-import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
 import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
+import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
 
 export abstract class Actor implements ActorServer {
   id: number
@@ -41,8 +41,8 @@ export abstract class Actor implements ActorServer {
     this.host = hash.host
     this.followingCount = hash.followingCount
     this.followersCount = hash.followersCount
-    this.createdAt = new Date(hash.createdAt.toString())
-    this.updatedAt = new Date(hash.updatedAt.toString())
+    this.createdAt = new Date(hash.createdAt)
+    this.updatedAt = new Date(hash.updatedAt)
     this.avatar = hash.avatar
 
     this.avatarUrl = Actor.GET_ACTOR_AVATAR_URL(this)
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts
index 39826d71e..ad2929db5 100644
--- a/client/src/app/shared/video/video-edit.model.ts
+++ b/client/src/app/shared/video/video-edit.model.ts
@@ -10,7 +10,7 @@ export class VideoEdit {
   tags: string[]
   nsfw: boolean
   commentsEnabled: boolean
-  channel: number
+  channelId: number
   privacy: VideoPrivacy
   support: string
   thumbnailfile?: any
@@ -32,7 +32,7 @@ export class VideoEdit {
       this.tags = videoDetails.tags
       this.nsfw = videoDetails.nsfw
       this.commentsEnabled = videoDetails.commentsEnabled
-      this.channel = videoDetails.channel.id
+      this.channelId = videoDetails.channel.id
       this.privacy = videoDetails.privacy.id
       this.support = videoDetails.support
       this.thumbnailUrl = videoDetails.thumbnailUrl
@@ -57,7 +57,7 @@ export class VideoEdit {
       tags: this.tags,
       nsfw: this.nsfw,
       commentsEnabled: this.commentsEnabled,
-      channelId: this.channel,
+      channelId: this.channelId,
       privacy: this.privacy
     }
   }
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts
index f56eecaeb..48d562f9c 100644
--- a/client/src/app/shared/video/video.model.ts
+++ b/client/src/app/shared/video/video.model.ts
@@ -45,6 +45,16 @@ export class Video implements VideoServerModel {
     avatar: Avatar
   }
 
+  channel: {
+    id: number
+    uuid: string
+    name: string
+    displayName: string
+    url: string
+    host: string
+    avatar: Avatar
+  }
+
   private static createDurationString (duration: number) {
     const hours = Math.floor(duration / 3600)
     const minutes = Math.floor(duration % 3600 / 60)
diff --git a/client/src/app/shared/video/video.service.ts b/client/src/app/shared/video/video.service.ts
index b45777c55..cd8539b41 100644
--- a/client/src/app/shared/video/video.service.ts
+++ b/client/src/app/shared/video/video.service.ts
@@ -67,6 +67,7 @@ export class VideoService {
       language,
       support,
       description,
+      channelId: video.channelId,
       privacy: video.privacy,
       tags: video.tags,
       nsfw: video.nsfw,
-- 
cgit v1.2.3