aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/video/video-details.model.ts52
-rw-r--r--client/src/app/shared/video/video-edit.model.ts8
-rw-r--r--client/src/app/shared/video/video.model.ts13
3 files changed, 22 insertions, 51 deletions
diff --git a/client/src/app/shared/video/video-details.model.ts b/client/src/app/shared/video/video-details.model.ts
index 1882a8165..9fc326beb 100644
--- a/client/src/app/shared/video/video-details.model.ts
+++ b/client/src/app/shared/video/video-details.model.ts
@@ -1,57 +1,33 @@
1import { 1import {
2 UserRight, VideoChannel, VideoDetails as VideoDetailsServerModel, VideoFile, VideoPrivacy, 2 UserRight,
3 VideoChannel,
4 VideoDetails as VideoDetailsServerModel,
5 VideoFile,
6 VideoPrivacy,
3 VideoResolution 7 VideoResolution
4} from '../../../../../shared' 8} from '../../../../../shared'
5import { Account } from '../../../../../shared/models/actors' 9import { Account } from '../../../../../shared/models/actors'
10import { VideoConstant } from '../../../../../shared/models/videos/video.model'
6import { AuthUser } from '../../core' 11import { AuthUser } from '../../core'
7import { Video } from '../../shared/video/video.model' 12import { Video } from '../../shared/video/video.model'
8 13
9export class VideoDetails extends Video implements VideoDetailsServerModel { 14export class VideoDetails extends Video implements VideoDetailsServerModel {
10 accountName: string 15 privacy: VideoConstant<VideoPrivacy>
11 by: string 16 descriptionPath: string
12 createdAt: Date
13 updatedAt: Date
14 categoryLabel: string
15 category: number
16 licenceLabel: string
17 licence: number
18 languageLabel: string
19 language: number
20 description: string
21 support: string 17 support: string
22 duration: number 18 channel: VideoChannel
23 durationLabel: string
24 id: number
25 uuid: string
26 isLocal: boolean
27 name: string
28 serverHost: string
29 tags: string[] 19 tags: string[]
30 thumbnailPath: string
31 thumbnailUrl: string
32 previewPath: string
33 previewUrl: string
34 embedPath: string
35 embedUrl: string
36 views: number
37 likes: number
38 dislikes: number
39 nsfw: boolean
40 descriptionPath: string
41 files: VideoFile[] 20 files: VideoFile[]
42 channel: VideoChannel
43 privacy: VideoPrivacy
44 privacyLabel: string
45 account: Account 21 account: Account
22 commentsEnabled: boolean
23
46 likesPercent: number 24 likesPercent: number
47 dislikesPercent: number 25 dislikesPercent: number
48 commentsEnabled: boolean
49 26
50 constructor (hash: VideoDetailsServerModel) { 27 constructor (hash: VideoDetailsServerModel) {
51 super(hash) 28 super(hash)
52 29
53 this.privacy = hash.privacy 30 this.privacy = hash.privacy
54 this.privacyLabel = hash.privacyLabel
55 this.descriptionPath = hash.descriptionPath 31 this.descriptionPath = hash.descriptionPath
56 this.files = hash.files 32 this.files = hash.files
57 this.channel = hash.channel 33 this.channel = hash.channel
@@ -72,14 +48,14 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
72 48
73 // If the download speed is too bad, return the lowest resolution we have 49 // If the download speed is too bad, return the lowest resolution we have
74 if (betterResolutionFile === undefined) { 50 if (betterResolutionFile === undefined) {
75 betterResolutionFile = this.files.find(f => f.resolution === VideoResolution.H_240P) 51 betterResolutionFile = this.files.find(f => f.resolution.id === VideoResolution.H_240P)
76 } 52 }
77 53
78 return betterResolutionFile.magnetUri 54 return betterResolutionFile.magnetUri
79 } 55 }
80 56
81 isRemovableBy (user: AuthUser) { 57 isRemovableBy (user: AuthUser) {
82 return user && this.isLocal === true && (this.accountName === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO)) 58 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.REMOVE_ANY_VIDEO))
83 } 59 }
84 60
85 isBlackistableBy (user: AuthUser) { 61 isBlackistableBy (user: AuthUser) {
@@ -87,7 +63,7 @@ export class VideoDetails extends Video implements VideoDetailsServerModel {
87 } 63 }
88 64
89 isUpdatableBy (user: AuthUser) { 65 isUpdatableBy (user: AuthUser) {
90 return user && this.isLocal === true && (this.accountName === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO)) 66 return user && this.isLocal === true && (this.account.name === user.username || user.hasRight(UserRight.UPDATE_ANY_VIDEO))
91 } 67 }
92 68
93 buildLikeAndDislikePercents () { 69 buildLikeAndDislikePercents () {
diff --git a/client/src/app/shared/video/video-edit.model.ts b/client/src/app/shared/video/video-edit.model.ts
index a8bbb63eb..c1a70d1b3 100644
--- a/client/src/app/shared/video/video-edit.model.ts
+++ b/client/src/app/shared/video/video-edit.model.ts
@@ -24,16 +24,16 @@ export class VideoEdit {
24 if (videoDetails) { 24 if (videoDetails) {
25 this.id = videoDetails.id 25 this.id = videoDetails.id
26 this.uuid = videoDetails.uuid 26 this.uuid = videoDetails.uuid
27 this.category = videoDetails.category 27 this.category = videoDetails.category.id
28 this.licence = videoDetails.licence 28 this.licence = videoDetails.licence.id
29 this.language = videoDetails.language 29 this.language = videoDetails.language.id
30 this.description = videoDetails.description 30 this.description = videoDetails.description
31 this.name = videoDetails.name 31 this.name = videoDetails.name
32 this.tags = videoDetails.tags 32 this.tags = videoDetails.tags
33 this.nsfw = videoDetails.nsfw 33 this.nsfw = videoDetails.nsfw
34 this.commentsEnabled = videoDetails.commentsEnabled 34 this.commentsEnabled = videoDetails.commentsEnabled
35 this.channel = videoDetails.channel.id 35 this.channel = videoDetails.channel.id
36 this.privacy = videoDetails.privacy 36 this.privacy = videoDetails.privacy.id
37 this.support = videoDetails.support 37 this.support = videoDetails.support
38 this.thumbnailUrl = videoDetails.thumbnailUrl 38 this.thumbnailUrl = videoDetails.thumbnailUrl
39 this.previewUrl = videoDetails.previewUrl 39 this.previewUrl = videoDetails.previewUrl
diff --git a/client/src/app/shared/video/video.model.ts b/client/src/app/shared/video/video.model.ts
index 50ca9eb99..7b68933a1 100644
--- a/client/src/app/shared/video/video.model.ts
+++ b/client/src/app/shared/video/video.model.ts
@@ -2,18 +2,16 @@ import { Account } from '@app/shared/account/account.model'
2import { User } from '../' 2import { User } from '../'
3import { Video as VideoServerModel } from '../../../../../shared' 3import { Video as VideoServerModel } from '../../../../../shared'
4import { Avatar } from '../../../../../shared/models/avatars/avatar.model' 4import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
5import { VideoConstant } from '../../../../../shared/models/videos/video.model'
5import { getAbsoluteAPIUrl } from '../misc/utils' 6import { getAbsoluteAPIUrl } from '../misc/utils'
6 7
7export class Video implements VideoServerModel { 8export class Video implements VideoServerModel {
8 by: string 9 by: string
9 createdAt: Date 10 createdAt: Date
10 updatedAt: Date 11 updatedAt: Date
11 categoryLabel: string 12 category: VideoConstant<number>
12 category: number 13 licence: VideoConstant<number>
13 licenceLabel: string 14 language: VideoConstant<number>
14 licence: number
15 languageLabel: string
16 language: number
17 description: string 15 description: string
18 duration: number 16 duration: number
19 durationLabel: string 17 durationLabel: string
@@ -58,11 +56,8 @@ export class Video implements VideoServerModel {
58 const absoluteAPIUrl = getAbsoluteAPIUrl() 56 const absoluteAPIUrl = getAbsoluteAPIUrl()
59 57
60 this.createdAt = new Date(hash.createdAt.toString()) 58 this.createdAt = new Date(hash.createdAt.toString())
61 this.categoryLabel = hash.categoryLabel
62 this.category = hash.category 59 this.category = hash.category
63 this.licenceLabel = hash.licenceLabel
64 this.licence = hash.licence 60 this.licence = hash.licence
65 this.languageLabel = hash.languageLabel
66 this.language = hash.language 61 this.language = hash.language
67 this.description = hash.description 62 this.description = hash.description
68 this.duration = hash.duration 63 this.duration = hash.duration