diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-15 15:52:18 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-15 15:52:18 +0100 |
commit | 41d713446c2152d47943ddb0c841a9e36ca5a9db (patch) | |
tree | 7b22f6f7ea5652107ef503470d2455c4bb087799 /client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts | |
parent | 17036be5bc2f14dc4e66053087e39887599df4de (diff) | |
download | PeerTube-41d713446c2152d47943ddb0c841a9e36ca5a9db.tar.gz PeerTube-41d713446c2152d47943ddb0c841a9e36ca5a9db.tar.zst PeerTube-41d713446c2152d47943ddb0c841a9e36ca5a9db.zip |
Lazy import some modules
Diffstat (limited to 'client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts')
-rw-r--r-- | client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index 00c871659..3aa875668 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts | |||
@@ -19,7 +19,7 @@ import { MarkdownService } from '@app/shared/renderer' | |||
19 | export class VideoAbuseListComponent extends RestTable implements OnInit { | 19 | export class VideoAbuseListComponent extends RestTable implements OnInit { |
20 | @ViewChild('moderationCommentModal') moderationCommentModal: ModerationCommentModalComponent | 20 | @ViewChild('moderationCommentModal') moderationCommentModal: ModerationCommentModalComponent |
21 | 21 | ||
22 | videoAbuses: VideoAbuse[] = [] | 22 | videoAbuses: (VideoAbuse & { moderationCommentHtml?: string, reasonHtml?: string })[] = [] |
23 | totalRecords = 0 | 23 | totalRecords = 0 |
24 | rowsPerPage = 10 | 24 | rowsPerPage = 10 |
25 | sort: SortMeta = { field: 'createdAt', order: 1 } | 25 | sort: SortMeta = { field: 'createdAt', order: 1 } |
@@ -110,19 +110,28 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | toHtml (text: string) { | ||
114 | return this.markdownRenderer.textMarkdownToHTML(text) | ||
115 | } | ||
116 | |||
117 | protected loadData () { | 113 | protected loadData () { |
118 | return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort) | 114 | return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort) |
119 | .subscribe( | 115 | .subscribe( |
120 | resultList => { | 116 | async resultList => { |
121 | this.videoAbuses = resultList.data | ||
122 | this.totalRecords = resultList.total | 117 | this.totalRecords = resultList.total |
118 | |||
119 | this.videoAbuses = resultList.data | ||
120 | |||
121 | for (const abuse of this.videoAbuses) { | ||
122 | Object.assign(abuse, { | ||
123 | reasonHtml: await this.toHtml(abuse.reason), | ||
124 | moderationCommentHtml: await this.toHtml(abuse.moderationComment) | ||
125 | }) | ||
126 | } | ||
127 | |||
123 | }, | 128 | }, |
124 | 129 | ||
125 | err => this.notifier.error(err.message) | 130 | err => this.notifier.error(err.message) |
126 | ) | 131 | ) |
127 | } | 132 | } |
133 | |||
134 | private toHtml (text: string) { | ||
135 | return this.markdownRenderer.textMarkdownToHTML(text) | ||
136 | } | ||
128 | } | 137 | } |