From 7ccddd7b5250bd25a917a6e77e58b87b9484a2a4 Mon Sep 17 00:00:00 2001 From: Josh Morel Date: Tue, 2 Apr 2019 05:26:47 -0400 Subject: add quarantine videos feature (#1637) * add quarantine videos feature * increase Notification settings test timeout to 20000ms. was completing 7000 locally but timing out after 10000 on travis * fix quarantine video test issues -propagate misspelling -remove skip from server/tests/client.ts * WIP use blacklist for moderator video approval instead of video.quarantine boolean * finish auto-blacklist feature --- shared/utils/videos/video-blacklist.ts | 13 +++++++++++++ shared/utils/videos/video-change-ownership.ts | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'shared/utils/videos') diff --git a/shared/utils/videos/video-blacklist.ts b/shared/utils/videos/video-blacklist.ts index f2ae0ed26..82d5b7e31 100644 --- a/shared/utils/videos/video-blacklist.ts +++ b/shared/utils/videos/video-blacklist.ts @@ -51,6 +51,18 @@ function getBlacklistedVideosList (url: string, token: string, specialStatus = 2 .expect('Content-Type', /json/) } +function getBlacklistedVideosListWithTypeFilter (url: string, token: string, type: number, specialStatus = 200) { + const path = '/api/v1/videos/blacklist/' + + return request(url) + .get(path) + .query({ sort: 'createdAt', type }) + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + token) + .expect(specialStatus) + .expect('Content-Type', /json/) +} + function getSortedBlacklistedVideosList (url: string, token: string, sort: string, specialStatus = 200) { const path = '/api/v1/videos/blacklist/' @@ -69,6 +81,7 @@ export { addVideoToBlacklist, removeVideoFromBlacklist, getBlacklistedVideosList, + getBlacklistedVideosListWithTypeFilter, getSortedBlacklistedVideosList, updateVideoBlacklist } diff --git a/shared/utils/videos/video-change-ownership.ts b/shared/utils/videos/video-change-ownership.ts index f288692ea..371d02000 100644 --- a/shared/utils/videos/video-change-ownership.ts +++ b/shared/utils/videos/video-change-ownership.ts @@ -1,6 +1,6 @@ import * as request from 'supertest' -function changeVideoOwnership (url: string, token: string, videoId: number | string, username) { +function changeVideoOwnership (url: string, token: string, videoId: number | string, username, expectedStatus = 204) { const path = '/api/v1/videos/' + videoId + '/give-ownership' return request(url) @@ -8,7 +8,7 @@ function changeVideoOwnership (url: string, token: string, videoId: number | str .set('Accept', 'application/json') .set('Authorization', 'Bearer ' + token) .send({ username }) - .expect(204) + .expect(expectedStatus) } function getVideoChangeOwnershipList (url: string, token: string) { -- cgit v1.2.3