aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-04-18 10:00:19 +0200
committerRigel Kent <par@rigelk.eu>2020-05-01 16:41:02 +0200
commit844db39ee56ff0dd59a96acfc68f10f9ac53000b (patch)
treee9b33b09c08465e73819cf189a112ec17b044349 /client
parent36d0677ec95605eca0543712686c591fb8e6f3c1 (diff)
downloadPeerTube-844db39ee56ff0dd59a96acfc68f10f9ac53000b.tar.gz
PeerTube-844db39ee56ff0dd59a96acfc68f10f9ac53000b.tar.zst
PeerTube-844db39ee56ff0dd59a96acfc68f10f9ac53000b.zip
Add search for video, reporter and channel name fields
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html36
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss8
-rw-r--r--client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts52
-rw-r--r--client/src/app/shared/video-abuse/video-abuse.service.ts9
4 files changed, 75 insertions, 30 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 2204bb371..c1ce093d7 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
@@ -4,6 +4,17 @@
4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate 4 [showCurrentPageReport]="true" i18n-currentPageReportTemplate
5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports" 5 currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} reports"
6> 6>
7 <ng-template pTemplate="caption">
8 <div class="caption">
9 <div class="ml-auto">
10 <input
11 type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
12 (keyup)="onSearch($event)"
13 >
14 </div>
15 </div>
16 </ng-template>
17
7 <ng-template pTemplate="header"> 18 <ng-template pTemplate="header">
8 <tr> <!-- header --> 19 <tr> <!-- header -->
9 <th style="width: 40px;"></th> 20 <th style="width: 40px;"></th>
@@ -40,18 +51,14 @@
40 </a> 51 </a>
41 </td> 52 </td>
42 53
43 <td> 54 <td *ngIf="!videoAbuse.video.deleted">
44 <a [href]="getVideoUrl(videoAbuse)" class="video-abuse-video-link" i18n-title title="Open video in a new tab" target="_blank" rel="noopener noreferrer"> 55 <a [href]="getVideoUrl(videoAbuse)" class="video-abuse-video-link" i18n-title title="Open video in a new tab" target="_blank" rel="noopener noreferrer">
45 <div class="video-abuse-video"> 56 <div class="video-abuse-video">
46 <div class="video-abuse-video-image"> 57 <div class="video-abuse-video-image"><img [src]="videoAbuse.video.thumbnailPath"></div>
47 <img *ngIf="!videoAbuse.video.deleted" [src]="videoAbuse.video.thumbnailPath">
48 <span *ngIf="videoAbuse.video.deleted" i18n>Deleted</span>
49 </div>
50 <div class="video-abuse-video-text"> 58 <div class="video-abuse-video-text">
51 <div> 59 <div>
52 {{ videoAbuse.video.name }} 60 {{ videoAbuse.video.name }}
53 <span *ngIf="!videoAbuse.video.deleted && !videoAbuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span> 61 <span *ngIf="!videoAbuse.video.blacklisted" class="glyphicon glyphicon-new-window"></span>
54 <span *ngIf="videoAbuse.video.deleted" i18n-title title="Video was deleted" class="glyphicon glyphicon-trash"></span>
55 <span *ngIf="videoAbuse.video.blacklisted" i18n-title title="Video was blacklisted" class="glyphicon glyphicon-ban-circle"></span> 62 <span *ngIf="videoAbuse.video.blacklisted" i18n-title title="Video was blacklisted" class="glyphicon glyphicon-ban-circle"></span>
56 </div> 63 </div>
57 <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div> 64 <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div>
@@ -60,7 +67,20 @@
60 </a> 67 </a>
61 </td> 68 </td>
62 69
63 <td>{{ videoAbuse.createdAt }}</td> 70 <td *ngIf="videoAbuse.video.deleted" class="c-hand" [pRowToggler]="videoAbuse">
71 <div class="video-abuse-video" i18n-title title="Video was deleted">
72 <div class="video-abuse-video-image"><span i18n>Deleted</span></div>
73 <div class="video-abuse-video-text">
74 <div>
75 {{ videoAbuse.video.name }}
76 <span class="glyphicon glyphicon-trash"></span>
77 </div>
78 <div class="text-muted">by {{ videoAbuse.video.channel?.displayName }} on {{ videoAbuse.video.channel?.host }} </div>
79 </div>
80 </div>
81 </td>
82
83 <td class="c-hand" [pRowToggler]="videoAbuse">{{ videoAbuse.createdAt }}</td>
64 84
65 <td class="c-hand video-abuse-states" [pRowToggler]="videoAbuse"> 85 <td class="c-hand video-abuse-states" [pRowToggler]="videoAbuse">
66 <span *ngIf="isVideoAbuseAccepted(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-ok"></span> 86 <span *ngIf="isVideoAbuseAccepted(videoAbuse)" [title]="videoAbuse.state.label" class="glyphicon glyphicon-ok"></span>
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss
index 09402fda7..9b60c39dc 100644
--- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss
+++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.scss
@@ -1,6 +1,14 @@
1@import 'mixins'; 1@import 'mixins';
2@import 'miniature'; 2@import 'miniature';
3 3
4.caption {
5 justify-content: flex-end;
6
7 input {
8 @include peertube-input-text(250px);
9 }
10}
11
4.video-abuse-video-link { 12.video-abuse-video-link {
5 @include disable-outline; 13 @include disable-outline;
6 position: relative; 14 position: relative;
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 cc5014ae8..6dcf96ccf 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
@@ -16,6 +16,8 @@ import { getAbsoluteAPIUrl } from '@app/shared/misc/utils'
16import { DomSanitizer } from '@angular/platform-browser' 16import { DomSanitizer } from '@angular/platform-browser'
17import { BlocklistService } from '@app/shared/blocklist' 17import { BlocklistService } from '@app/shared/blocklist'
18import { VideoService } from '@app/shared/video/video.service' 18import { VideoService } from '@app/shared/video/video.service'
19import { ActivatedRoute } from '@angular/router'
20import { first } from 'rxjs/operators'
19 21
20@Component({ 22@Component({
21 selector: 'my-video-abuse-list', 23 selector: 'my-video-abuse-list',
@@ -43,7 +45,8 @@ export class VideoAbuseListComponent extends RestTable implements OnInit {
43 private confirmService: ConfirmService, 45 private confirmService: ConfirmService,
44 private i18n: I18n, 46 private i18n: I18n,
45 private markdownRenderer: MarkdownService, 47 private markdownRenderer: MarkdownService,
46 private sanitizer: DomSanitizer 48 private sanitizer: DomSanitizer,
49 private route: ActivatedRoute,
47 ) { 50 ) {
48 super() 51 super()
49 52
@@ -185,6 +188,10 @@ export class VideoAbuseListComponent extends RestTable implements OnInit {
185 188
186 ngOnInit () { 189 ngOnInit () {
187 this.initialize() 190 this.initialize()
191
192 this.route.queryParams
193 .pipe(first(params => params.search !== undefined && params.search !== null))
194 .subscribe(params => this.search = params.search)
188 } 195 }
189 196
190 getIdentifier () { 197 getIdentifier () {
@@ -253,26 +260,29 @@ export class VideoAbuseListComponent extends RestTable implements OnInit {
253 } 260 }
254 261
255 protected loadData () { 262 protected loadData () {
256 return this.videoAbuseService.getVideoAbuses(this.pagination, this.sort) 263 return this.videoAbuseService.getVideoAbuses({
257 .subscribe( 264 pagination: this.pagination,
258 async resultList => { 265 sort: this.sort,
259 this.totalRecords = resultList.total 266 search: this.search
260 267 }).subscribe(
261 this.videoAbuses = resultList.data 268 async resultList => {
262 269 this.totalRecords = resultList.total
263 for (const abuse of this.videoAbuses) { 270
264 Object.assign(abuse, { 271 this.videoAbuses = resultList.data
265 reasonHtml: await this.toHtml(abuse.reason), 272
266 moderationCommentHtml: await this.toHtml(abuse.moderationComment), 273 for (const abuse of this.videoAbuses) {
267 embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)), 274 Object.assign(abuse, {
268 reporterAccount: new Account(abuse.reporterAccount) 275 reasonHtml: await this.toHtml(abuse.reason),
269 }) 276 moderationCommentHtml: await this.toHtml(abuse.moderationComment),
270 } 277 embedHtml: this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse)),
271 278 reporterAccount: new Account(abuse.reporterAccount)
272 }, 279 })
273 280 }
274 err => this.notifier.error(err.message) 281
275 ) 282 },
283
284 err => this.notifier.error(err.message)
285 )
276 } 286 }
277 287
278 private toHtml (text: string) { 288 private toHtml (text: string) {
diff --git a/client/src/app/shared/video-abuse/video-abuse.service.ts b/client/src/app/shared/video-abuse/video-abuse.service.ts
index 61a328575..a39ad31d4 100644
--- a/client/src/app/shared/video-abuse/video-abuse.service.ts
+++ b/client/src/app/shared/video-abuse/video-abuse.service.ts
@@ -17,12 +17,19 @@ export class VideoAbuseService {
17 private restExtractor: RestExtractor 17 private restExtractor: RestExtractor
18 ) {} 18 ) {}
19 19
20 getVideoAbuses (pagination: RestPagination, sort: SortMeta): Observable<ResultList<VideoAbuse>> { 20 getVideoAbuses (options: {
21 pagination: RestPagination,
22 sort: SortMeta,
23 search?: string
24 }): Observable<ResultList<VideoAbuse>> {
25 const { pagination, sort, search } = options
21 const url = VideoAbuseService.BASE_VIDEO_ABUSE_URL + 'abuse' 26 const url = VideoAbuseService.BASE_VIDEO_ABUSE_URL + 'abuse'
22 27
23 let params = new HttpParams() 28 let params = new HttpParams()
24 params = this.restService.addRestGetParams(params, pagination, sort) 29 params = this.restService.addRestGetParams(params, pagination, sort)
25 30
31 if (search) params = params.append('search', search)
32
26 return this.authHttp.get<ResultList<VideoAbuse>>(url, { params }) 33 return this.authHttp.get<ResultList<VideoAbuse>>(url, { params })
27 .pipe( 34 .pipe(
28 map(res => this.restExtractor.convertResultListDateToHuman(res)), 35 map(res => this.restExtractor.convertResultListDateToHuman(res)),