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
20 accountAvatarUrl: string
24 constructor (hash: VideoCommentServerModel) {
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.deletedAt = hash.deletedAt ? new Date(hash.deletedAt.toString()) : null
34 this.isDeleted = hash.isDeleted
35 this.account = hash.account
36 this.totalReplies = hash.totalReplies
39 this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host)
40 this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account)
42 const absoluteAPIUrl = getAbsoluteAPIUrl()
43 const thisHost = new URL(absoluteAPIUrl).host
44 this.isLocal = this.account.host.trim() === thisHost