aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/video-abuse
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-06 17:39:07 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-07 08:33:34 +0200
commitfeb34f6b6b991046aab6a10df747b48fa4da07a7 (patch)
tree02bb7277d45be166ba48caef2ee73bf89dbe1258 /client/src/app/shared/video-abuse
parentd170c5c580abf6f90d7bf144e2417e248ce2ecf4 (diff)
downloadPeerTube-feb34f6b6b991046aab6a10df747b48fa4da07a7.tar.gz
PeerTube-feb34f6b6b991046aab6a10df747b48fa4da07a7.tar.zst
PeerTube-feb34f6b6b991046aab6a10df747b48fa4da07a7.zip
Use video abuse filters on client side
Diffstat (limited to 'client/src/app/shared/video-abuse')
-rw-r--r--client/src/app/shared/video-abuse/video-abuse.service.ts31
1 files changed, 29 insertions, 2 deletions
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 1ab6b5376..700a30239 100644
--- a/client/src/app/shared/video-abuse/video-abuse.service.ts
+++ b/client/src/app/shared/video-abuse/video-abuse.service.ts
@@ -3,7 +3,7 @@ import { HttpClient, HttpParams } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { SortMeta } from 'primeng/api' 4import { SortMeta } from 'primeng/api'
5import { Observable } from 'rxjs' 5import { Observable } from 'rxjs'
6import { ResultList, VideoAbuse, VideoAbuseUpdate } from '../../../../../shared' 6import { ResultList, VideoAbuse, VideoAbuseUpdate, VideoAbuseState } from '../../../../../shared'
7import { environment } from '../../../environments/environment' 7import { environment } from '../../../environments/environment'
8import { RestExtractor, RestPagination, RestService } from '../rest' 8import { RestExtractor, RestPagination, RestService } from '../rest'
9 9
@@ -28,7 +28,34 @@ export class VideoAbuseService {
28 let params = new HttpParams() 28 let params = new HttpParams()
29 params = this.restService.addRestGetParams(params, pagination, sort) 29 params = this.restService.addRestGetParams(params, pagination, sort)
30 30
31 if (search) params = params.append('search', search) 31 if (search) {
32 const filters = this.restService.parseQueryStringFilter(search, {
33 id: { prefix: '#' },
34 state: {
35 prefix: 'state:',
36 handler: v => {
37 if (v === 'accepted') return VideoAbuseState.ACCEPTED
38 if (v === 'pending') return VideoAbuseState.PENDING
39 if (v === 'rejected') return VideoAbuseState.REJECTED
40
41 return undefined
42 }
43 },
44 videoIs: {
45 prefix: 'videoIs:',
46 handler: v => {
47 if (v === 'deleted') return v
48 if (v === 'blacklisted') return v
49
50 return undefined
51 }
52 },
53 searchReporter: { prefix: 'reporter:' },
54 searchReportee: { prefix: 'reportee:' }
55 })
56
57 params = this.restService.addObjectParams(params, filters)
58 }
32 59
33 return this.authHttp.get<ResultList<VideoAbuse>>(url, { params }) 60 return this.authHttp.get<ResultList<VideoAbuse>>(url, { params })
34 .pipe( 61 .pipe(