aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/video-abuses.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/videos/video-abuses.ts')
-rw-r--r--shared/extra-utils/videos/video-abuses.ts18
1 files changed, 15 insertions, 3 deletions
diff --git a/shared/extra-utils/videos/video-abuses.ts b/shared/extra-utils/videos/video-abuses.ts
index 81582bfc7..ff006672a 100644
--- a/shared/extra-utils/videos/video-abuses.ts
+++ b/shared/extra-utils/videos/video-abuses.ts
@@ -1,17 +1,26 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { VideoAbuseUpdate } from '../../models/videos/abuse/video-abuse-update.model' 2import { VideoAbuseUpdate } from '../../models/videos/abuse/video-abuse-update.model'
3import { makeDeleteRequest, makePutBodyRequest, makeGetRequest } from '../requests/requests' 3import { makeDeleteRequest, makePutBodyRequest, makeGetRequest } from '../requests/requests'
4import { VideoAbuseState } from '@shared/models' 4import { VideoAbuseState, VideoAbusePredefinedReasonsString } from '@shared/models'
5import { VideoAbuseVideoIs } from '@shared/models/videos/abuse/video-abuse-video-is.type' 5import { VideoAbuseVideoIs } from '@shared/models/videos/abuse/video-abuse-video-is.type'
6 6
7function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) { 7function reportVideoAbuse (
8 url: string,
9 token: string,
10 videoId: number | string,
11 reason: string,
12 predefinedReasons?: VideoAbusePredefinedReasonsString[],
13 startAt?: number,
14 endAt?: number,
15 specialStatus = 200
16) {
8 const path = '/api/v1/videos/' + videoId + '/abuse' 17 const path = '/api/v1/videos/' + videoId + '/abuse'
9 18
10 return request(url) 19 return request(url)
11 .post(path) 20 .post(path)
12 .set('Accept', 'application/json') 21 .set('Accept', 'application/json')
13 .set('Authorization', 'Bearer ' + token) 22 .set('Authorization', 'Bearer ' + token)
14 .send({ reason }) 23 .send({ reason, predefinedReasons, startAt, endAt })
15 .expect(specialStatus) 24 .expect(specialStatus)
16} 25}
17 26
@@ -19,6 +28,7 @@ function getVideoAbusesList (options: {
19 url: string 28 url: string
20 token: string 29 token: string
21 id?: number 30 id?: number
31 predefinedReason?: VideoAbusePredefinedReasonsString
22 search?: string 32 search?: string
23 state?: VideoAbuseState 33 state?: VideoAbuseState
24 videoIs?: VideoAbuseVideoIs 34 videoIs?: VideoAbuseVideoIs
@@ -31,6 +41,7 @@ function getVideoAbusesList (options: {
31 url, 41 url,
32 token, 42 token,
33 id, 43 id,
44 predefinedReason,
34 search, 45 search,
35 state, 46 state,
36 videoIs, 47 videoIs,
@@ -44,6 +55,7 @@ function getVideoAbusesList (options: {
44 const query = { 55 const query = {
45 sort: 'createdAt', 56 sort: 'createdAt',
46 id, 57 id,
58 predefinedReason,
47 search, 59 search,
48 state, 60 state,
49 videoIs, 61 videoIs,