1 import { Account as AccountInterface } from '../../../../../../shared/models/actors'
2 import { VideoComment as VideoCommentServerModel } from '../../../../../../shared/models/videos/video-comment.model'
3 import { Actor } from '@app/shared/actor/actor.model'
4 import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
6 export class VideoComment implements VideoCommentServerModel {
11 inReplyToCommentId: number
13 createdAt: Date | string
14 updatedAt: Date | string
15 deletedAt: Date | string
17 account: AccountInterface
18 totalRepliesFromVideoAuthor: number
21 accountAvatarUrl: string
25 constructor (hash: VideoCommentServerModel) {
29 this.threadId = hash.threadId
30 this.inReplyToCommentId = hash.inReplyToCommentId
31 this.videoId = hash.videoId
32 this.createdAt = new Date(hash.createdAt.toString())
33 this.updatedAt = new Date(hash.updatedAt.toString())
34 this.deletedAt = hash.deletedAt ? new Date(hash.deletedAt.toString()) : null
35 this.isDeleted = hash.isDeleted
36 this.account = hash.account
37 this.totalRepliesFromVideoAuthor = hash.totalRepliesFromVideoAuthor
38 this.totalReplies = hash.totalReplies
41 this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host)
42 this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account)
44 const absoluteAPIUrl = getAbsoluteAPIUrl()
45 const thisHost = new URL(absoluteAPIUrl).host
46 this.isLocal = this.account.host.trim() === thisHost