aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/comment/video-comment.model.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-27 16:11:53 +0100
committerChocobozzz <me@florianbigard.com>2017-12-27 16:11:53 +0100
commit4635f59d7c3fea4b97029f10886c62fdf38b2084 (patch)
treed97357a00042bbfb33c4177ee24c01171d28dfce /client/src/app/videos/+video-watch/comment/video-comment.model.ts
parentea44f375f5d3da06ca0aebfe871b9f924a26ec29 (diff)
downloadPeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.tar.gz
PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.tar.zst
PeerTube-4635f59d7c3fea4b97029f10886c62fdf38b2084.zip
Add video comment components
Diffstat (limited to 'client/src/app/videos/+video-watch/comment/video-comment.model.ts')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.model.ts38
1 files changed, 38 insertions, 0 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.model.ts b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
new file mode 100644
index 000000000..df7d5244c
--- /dev/null
+++ b/client/src/app/videos/+video-watch/comment/video-comment.model.ts
@@ -0,0 +1,38 @@
1import { VideoComment as VideoCommentServerModel } from '../../../../../../shared/models/videos/video-comment.model'
2
3export class VideoComment implements VideoCommentServerModel {
4 id: number
5 url: string
6 text: string
7 threadId: number
8 inReplyToCommentId: number
9 videoId: number
10 createdAt: Date | string
11 updatedAt: Date | string
12 account: {
13 name: string
14 host: string
15 }
16 totalReplies: number
17
18 by: string
19
20 private static createByString (account: string, serverHost: string) {
21 return account + '@' + serverHost
22 }
23
24 constructor (hash: VideoCommentServerModel) {
25 this.id = hash.id
26 this.url = hash.url
27 this.text = hash.text
28 this.threadId = hash.threadId
29 this.inReplyToCommentId = hash.inReplyToCommentId
30 this.videoId = hash.videoId
31 this.createdAt = new Date(hash.createdAt.toString())
32 this.updatedAt = new Date(hash.updatedAt.toString())
33 this.account = hash.account
34 this.totalReplies = hash.totalReplies
35
36 this.by = VideoComment.createByString(this.account.name, this.account.host)
37 }
38}