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 account: AccountInterface
18 accountAvatarUrl: string
22 constructor (hash: VideoCommentServerModel) {
26 this.threadId = hash.threadId
27 this.inReplyToCommentId = hash.inReplyToCommentId
28 this.videoId = hash.videoId
29 this.createdAt = new Date(hash.createdAt.toString())
30 this.updatedAt = new Date(hash.updatedAt.toString())
31 this.account = hash.account
32 this.totalReplies = hash.totalReplies
34 this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host)
35 this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account)
37 const absoluteAPIUrl = getAbsoluteAPIUrl()
38 const thisHost = new URL(absoluteAPIUrl).host
39 this.isLocal = this.account.host.trim() === thisHost