]>
Commit | Line | Data |
---|---|---|
76d36e0b | 1 | import { Account as AccountInterface } from '../../../../../../shared/models/actors' |
4635f59d | 2 | import { VideoComment as VideoCommentServerModel } from '../../../../../../shared/models/videos/video-comment.model' |
d3e91a5f | 3 | import { Actor } from '@app/shared/actor/actor.model' |
7e73f071 | 4 | import { getAbsoluteAPIUrl } from '@app/shared/misc/utils' |
4635f59d C |
5 | |
6 | export class VideoComment implements VideoCommentServerModel { | |
7 | id: number | |
8 | url: string | |
9 | text: string | |
10 | threadId: number | |
11 | inReplyToCommentId: number | |
12 | videoId: number | |
13 | createdAt: Date | string | |
14 | updatedAt: Date | string | |
76d36e0b | 15 | account: AccountInterface |
4635f59d | 16 | totalReplies: number |
4635f59d | 17 | by: string |
244b4ae3 | 18 | accountAvatarUrl: string |
4635f59d | 19 | |
7e73f071 C |
20 | isLocal: boolean |
21 | ||
4635f59d C |
22 | constructor (hash: VideoCommentServerModel) { |
23 | this.id = hash.id | |
24 | this.url = hash.url | |
25 | this.text = hash.text | |
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 | |
33 | ||
d3e91a5f C |
34 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) |
35 | this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account) | |
7e73f071 C |
36 | |
37 | const absoluteAPIUrl = getAbsoluteAPIUrl() | |
38 | const thisHost = new URL(absoluteAPIUrl).host | |
39 | this.isLocal = this.account.host.trim() === thisHost | |
4635f59d C |
40 | } |
41 | } |