aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-15 15:52:18 +0100
committerChocobozzz <me@florianbigard.com>2019-02-15 15:52:18 +0100
commit41d713446c2152d47943ddb0c841a9e36ca5a9db (patch)
tree7b22f6f7ea5652107ef503470d2455c4bb087799 /client/src/app/+admin
parent17036be5bc2f14dc4e66053087e39887599df4de (diff)
downloadPeerTube-41d713446c2152d47943ddb0c841a9e36ca5a9db.tar.gz
PeerTube-41d713446c2152d47943ddb0c841a9e36ca5a9db.tar.zst
PeerTube-41d713446c2152d47943ddb0c841a9e36ca5a9db.zip
Lazy import some modules
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html4
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts23
-rw-r--r--client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html2
-rw-r--r--client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts11
4 files changed, 27 insertions, 13 deletions
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html
index 05b549de6..627437053 100644
--- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html
+++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html
@@ -51,11 +51,11 @@
51 <td class="moderation-expanded" colspan="6"> 51 <td class="moderation-expanded" colspan="6">
52 <div> 52 <div>
53 <span i18n class="moderation-expanded-label">Reason:</span> 53 <span i18n class="moderation-expanded-label">Reason:</span>
54 <span class="moderation-expanded-text" [innerHTML]="toHtml(videoAbuse.reason)"></span> 54 <span class="moderation-expanded-text" [innerHTML]="videoAbuse.reasonHtml"></span>
55 </div> 55 </div>
56 <div *ngIf="videoAbuse.moderationComment"> 56 <div *ngIf="videoAbuse.moderationComment">
57 <span i18n class="moderation-expanded-label">Moderation comment:</span> 57 <span i18n class="moderation-expanded-label">Moderation comment:</span>
58 <span class="moderation-expanded-text" [innerHTML]="toHtml(videoAbuse.moderationComment)"></span> 58 <span class="moderation-expanded-text" [innerHTML]="videoAbuse.moderationCommentHtml"></span>
59 </div> 59 </div>
60 </td> 60 </td>
61 </tr> 61 </tr>
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'
19export class VideoAbuseListComponent extends RestTable implements OnInit { 19export 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}
diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html
index 247f441c1..608dff2d8 100644
--- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html
+++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.html
@@ -41,7 +41,7 @@
41 <tr> 41 <tr>
42 <td class="moderation-expanded" colspan="6"> 42 <td class="moderation-expanded" colspan="6">
43 <span i18n class="moderation-expanded-label">Blacklist reason:</span> 43 <span i18n class="moderation-expanded-label">Blacklist reason:</span>
44 <span class="moderation-expanded-text" [innerHTML]="toHtml(videoBlacklist.reason)"></span> 44 <span class="moderation-expanded-text" [innerHTML]="videoBlacklist.reasonHtml"></span>
45 </td> 45 </td>
46 </tr> 46 </tr>
47 </ng-template> 47 </ng-template>
diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts
index b27bbbfef..5443d816d 100644
--- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts
+++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts
@@ -15,7 +15,7 @@ import { MarkdownService } from '@app/shared/renderer'
15 styleUrls: [ '../moderation.component.scss' ] 15 styleUrls: [ '../moderation.component.scss' ]
16}) 16})
17export class VideoBlacklistListComponent extends RestTable implements OnInit { 17export class VideoBlacklistListComponent extends RestTable implements OnInit {
18 blacklist: VideoBlacklist[] = [] 18 blacklist: (VideoBlacklist & { reasonHtml?: string })[] = []
19 totalRecords = 0 19 totalRecords = 0
20 rowsPerPage = 10 20 rowsPerPage = 10
21 sort: SortMeta = { field: 'createdAt', order: 1 } 21 sort: SortMeta = { field: 'createdAt', order: 1 }
@@ -79,9 +79,14 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit {
79 protected loadData () { 79 protected loadData () {
80 this.videoBlacklistService.listBlacklist(this.pagination, this.sort) 80 this.videoBlacklistService.listBlacklist(this.pagination, this.sort)
81 .subscribe( 81 .subscribe(
82 resultList => { 82 async resultList => {
83 this.blacklist = resultList.data
84 this.totalRecords = resultList.total 83 this.totalRecords = resultList.total
84
85 this.blacklist = resultList.data
86
87 for (const element of this.blacklist) {
88 Object.assign(element, { reasonHtml: await this.toHtml(element.reason) })
89 }
85 }, 90 },
86 91
87 err => this.notifier.error(err.message) 92 err => this.notifier.error(err.message)