From 1ebddadd0704812a4600c39cabe2268321e88331 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Mon, 22 Jun 2020 13:00:39 +0200 Subject: predefined report reasons & improved reporter UI (#2842) - added `startAt` and `endAt` optional timestamps to help pin down reported sections of a video - added predefined report reasons - added video player with report modal --- shared/extra-utils/videos/video-abuses.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'shared/extra-utils/videos') 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 @@ import * as request from 'supertest' import { VideoAbuseUpdate } from '../../models/videos/abuse/video-abuse-update.model' import { makeDeleteRequest, makePutBodyRequest, makeGetRequest } from '../requests/requests' -import { VideoAbuseState } from '@shared/models' +import { VideoAbuseState, VideoAbusePredefinedReasonsString } from '@shared/models' import { VideoAbuseVideoIs } from '@shared/models/videos/abuse/video-abuse-video-is.type' -function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) { +function reportVideoAbuse ( + url: string, + token: string, + videoId: number | string, + reason: string, + predefinedReasons?: VideoAbusePredefinedReasonsString[], + startAt?: number, + endAt?: number, + specialStatus = 200 +) { const path = '/api/v1/videos/' + videoId + '/abuse' return request(url) .post(path) .set('Accept', 'application/json') .set('Authorization', 'Bearer ' + token) - .send({ reason }) + .send({ reason, predefinedReasons, startAt, endAt }) .expect(specialStatus) } @@ -19,6 +28,7 @@ function getVideoAbusesList (options: { url: string token: string id?: number + predefinedReason?: VideoAbusePredefinedReasonsString search?: string state?: VideoAbuseState videoIs?: VideoAbuseVideoIs @@ -31,6 +41,7 @@ function getVideoAbusesList (options: { url, token, id, + predefinedReason, search, state, videoIs, @@ -44,6 +55,7 @@ function getVideoAbusesList (options: { const query = { sort: 'createdAt', id, + predefinedReason, search, state, videoIs, -- cgit v1.2.3