diff options
author | Chocobozzz <me@florianbigard.com> | 2020-07-09 15:54:24 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-07-10 14:02:41 +0200 |
commit | cfde28bac33c3644e1b6218eb471b675a37def60 (patch) | |
tree | eb648fc358a2face0f14c598c8eec7769e6b0ed5 /client/src/app/shared/shared-video-comment/video-comment.model.ts | |
parent | 8ca56654a176ee8f350d31282c6cac4a59f58499 (diff) | |
download | PeerTube-cfde28bac33c3644e1b6218eb471b675a37def60.tar.gz PeerTube-cfde28bac33c3644e1b6218eb471b675a37def60.tar.zst PeerTube-cfde28bac33c3644e1b6218eb471b675a37def60.zip |
Add ability to report account
Diffstat (limited to 'client/src/app/shared/shared-video-comment/video-comment.model.ts')
-rw-r--r-- | client/src/app/shared/shared-video-comment/video-comment.model.ts | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-video-comment/video-comment.model.ts b/client/src/app/shared/shared-video-comment/video-comment.model.ts new file mode 100644 index 000000000..e85443196 --- /dev/null +++ b/client/src/app/shared/shared-video-comment/video-comment.model.ts | |||
@@ -0,0 +1,48 @@ | |||
1 | import { getAbsoluteAPIUrl } from '@app/helpers' | ||
2 | import { Actor } from '@app/shared/shared-main' | ||
3 | import { Account as AccountInterface, VideoComment as VideoCommentServerModel } from '@shared/models' | ||
4 | |||
5 | export class VideoComment implements VideoCommentServerModel { | ||
6 | id: number | ||
7 | url: string | ||
8 | text: string | ||
9 | threadId: number | ||
10 | inReplyToCommentId: number | ||
11 | videoId: number | ||
12 | createdAt: Date | string | ||
13 | updatedAt: Date | string | ||
14 | deletedAt: Date | string | ||
15 | isDeleted: boolean | ||
16 | account: AccountInterface | ||
17 | totalRepliesFromVideoAuthor: number | ||
18 | totalReplies: number | ||
19 | by: string | ||
20 | accountAvatarUrl: string | ||
21 | |||
22 | isLocal: boolean | ||
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.deletedAt = hash.deletedAt ? new Date(hash.deletedAt.toString()) : null | ||
34 | this.isDeleted = hash.isDeleted | ||
35 | this.account = hash.account | ||
36 | this.totalRepliesFromVideoAuthor = hash.totalRepliesFromVideoAuthor | ||
37 | this.totalReplies = hash.totalReplies | ||
38 | |||
39 | if (this.account) { | ||
40 | this.by = Actor.CREATE_BY_STRING(this.account.name, this.account.host) | ||
41 | this.accountAvatarUrl = Actor.GET_ACTOR_AVATAR_URL(this.account) | ||
42 | |||
43 | const absoluteAPIUrl = getAbsoluteAPIUrl() | ||
44 | const thisHost = new URL(absoluteAPIUrl).host | ||
45 | this.isLocal = this.account.host.trim() === thisHost | ||
46 | } | ||
47 | } | ||
48 | } | ||