diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-10 14:41:20 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-10 14:50:16 +0100 |
commit | 7a4ea932461f228ae44a173ddcd48ffb088aa023 (patch) | |
tree | 429b6fa7dae496d339a9f22e4076e39ffda97461 /shared | |
parent | 403c69c5a34e6db621f30c7b2bfb2b80dc8e74c1 (diff) | |
download | PeerTube-7a4ea932461f228ae44a173ddcd48ffb088aa023.tar.gz PeerTube-7a4ea932461f228ae44a173ddcd48ffb088aa023.tar.zst PeerTube-7a4ea932461f228ae44a173ddcd48ffb088aa023.zip |
Remove deprecated abuse api
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/index.ts | 1 | ||||
-rw-r--r-- | shared/extra-utils/videos/video-abuses.ts | 114 | ||||
-rw-r--r-- | shared/models/moderation/abuse/abuse-create.model.ts | 8 | ||||
-rw-r--r-- | shared/models/moderation/abuse/abuse.model.ts | 12 |
4 files changed, 0 insertions, 135 deletions
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts index d118b12d2..8f5c709ff 100644 --- a/shared/extra-utils/index.ts +++ b/shared/extra-utils/index.ts | |||
@@ -19,7 +19,6 @@ export * from './users/accounts' | |||
19 | export * from './moderation/abuses' | 19 | export * from './moderation/abuses' |
20 | export * from './videos/services' | 20 | export * from './videos/services' |
21 | export * from './videos/live' | 21 | export * from './videos/live' |
22 | export * from './videos/video-abuses' | ||
23 | export * from './videos/video-blacklist' | 22 | export * from './videos/video-blacklist' |
24 | export * from './videos/video-captions' | 23 | export * from './videos/video-captions' |
25 | export * from './videos/video-channels' | 24 | export * from './videos/video-channels' |
diff --git a/shared/extra-utils/videos/video-abuses.ts b/shared/extra-utils/videos/video-abuses.ts deleted file mode 100644 index 8827b8196..000000000 --- a/shared/extra-utils/videos/video-abuses.ts +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | import * as request from 'supertest' | ||
2 | import { AbusePredefinedReasonsString, AbuseState, AbuseUpdate, AbuseVideoIs } from '@shared/models' | ||
3 | import { makeDeleteRequest, makeGetRequest, makePutBodyRequest } from '../requests/requests' | ||
4 | |||
5 | // FIXME: deprecated in 2.3. Remove this file | ||
6 | |||
7 | function reportVideoAbuse ( | ||
8 | url: string, | ||
9 | token: string, | ||
10 | videoId: number | string, | ||
11 | reason: string, | ||
12 | predefinedReasons?: AbusePredefinedReasonsString[], | ||
13 | startAt?: number, | ||
14 | endAt?: number, | ||
15 | specialStatus = 200 | ||
16 | ) { | ||
17 | const path = '/api/v1/videos/' + videoId + '/abuse' | ||
18 | |||
19 | return request(url) | ||
20 | .post(path) | ||
21 | .set('Accept', 'application/json') | ||
22 | .set('Authorization', 'Bearer ' + token) | ||
23 | .send({ reason, predefinedReasons, startAt, endAt }) | ||
24 | .expect(specialStatus) | ||
25 | } | ||
26 | |||
27 | function getVideoAbusesList (options: { | ||
28 | url: string | ||
29 | token: string | ||
30 | id?: number | ||
31 | predefinedReason?: AbusePredefinedReasonsString | ||
32 | search?: string | ||
33 | state?: AbuseState | ||
34 | videoIs?: AbuseVideoIs | ||
35 | searchReporter?: string | ||
36 | searchReportee?: string | ||
37 | searchVideo?: string | ||
38 | searchVideoChannel?: string | ||
39 | }) { | ||
40 | const { | ||
41 | url, | ||
42 | token, | ||
43 | id, | ||
44 | predefinedReason, | ||
45 | search, | ||
46 | state, | ||
47 | videoIs, | ||
48 | searchReporter, | ||
49 | searchReportee, | ||
50 | searchVideo, | ||
51 | searchVideoChannel | ||
52 | } = options | ||
53 | const path = '/api/v1/videos/abuse' | ||
54 | |||
55 | const query = { | ||
56 | sort: 'createdAt', | ||
57 | id, | ||
58 | predefinedReason, | ||
59 | search, | ||
60 | state, | ||
61 | videoIs, | ||
62 | searchReporter, | ||
63 | searchReportee, | ||
64 | searchVideo, | ||
65 | searchVideoChannel | ||
66 | } | ||
67 | |||
68 | return makeGetRequest({ | ||
69 | url, | ||
70 | path, | ||
71 | token, | ||
72 | query, | ||
73 | statusCodeExpected: 200 | ||
74 | }) | ||
75 | } | ||
76 | |||
77 | function updateVideoAbuse ( | ||
78 | url: string, | ||
79 | token: string, | ||
80 | videoId: string | number, | ||
81 | videoAbuseId: number, | ||
82 | body: AbuseUpdate, | ||
83 | statusCodeExpected = 204 | ||
84 | ) { | ||
85 | const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId | ||
86 | |||
87 | return makePutBodyRequest({ | ||
88 | url, | ||
89 | token, | ||
90 | path, | ||
91 | fields: body, | ||
92 | statusCodeExpected | ||
93 | }) | ||
94 | } | ||
95 | |||
96 | function deleteVideoAbuse (url: string, token: string, videoId: string | number, videoAbuseId: number, statusCodeExpected = 204) { | ||
97 | const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId | ||
98 | |||
99 | return makeDeleteRequest({ | ||
100 | url, | ||
101 | token, | ||
102 | path, | ||
103 | statusCodeExpected | ||
104 | }) | ||
105 | } | ||
106 | |||
107 | // --------------------------------------------------------------------------- | ||
108 | |||
109 | export { | ||
110 | reportVideoAbuse, | ||
111 | getVideoAbusesList, | ||
112 | updateVideoAbuse, | ||
113 | deleteVideoAbuse | ||
114 | } | ||
diff --git a/shared/models/moderation/abuse/abuse-create.model.ts b/shared/models/moderation/abuse/abuse-create.model.ts index b0358dbb9..0e7e9587f 100644 --- a/shared/models/moderation/abuse/abuse-create.model.ts +++ b/shared/models/moderation/abuse/abuse-create.model.ts | |||
@@ -19,11 +19,3 @@ export interface AbuseCreate { | |||
19 | id: number | 19 | id: number |
20 | } | 20 | } |
21 | } | 21 | } |
22 | |||
23 | // FIXME: deprecated in 2.3. Remove it | ||
24 | export interface VideoAbuseCreate { | ||
25 | reason: string | ||
26 | predefinedReasons?: AbusePredefinedReasonsString[] | ||
27 | startAt?: number | ||
28 | endAt?: number | ||
29 | } | ||
diff --git a/shared/models/moderation/abuse/abuse.model.ts b/shared/models/moderation/abuse/abuse.model.ts index 781870b1a..6048777ff 100644 --- a/shared/models/moderation/abuse/abuse.model.ts +++ b/shared/models/moderation/abuse/abuse.model.ts | |||
@@ -60,18 +60,6 @@ export interface AdminAbuse { | |||
60 | countReportsForReportee?: number | 60 | countReportsForReportee?: number |
61 | 61 | ||
62 | countMessages: number | 62 | countMessages: number |
63 | |||
64 | // FIXME: deprecated in 2.3, remove the following properties | ||
65 | |||
66 | // @deprecated | ||
67 | startAt?: null | ||
68 | // @deprecated | ||
69 | endAt?: null | ||
70 | |||
71 | // @deprecated | ||
72 | count?: number | ||
73 | // @deprecated | ||
74 | nth?: number | ||
75 | } | 63 | } |
76 | 64 | ||
77 | export type UserVideoAbuse = Omit<AdminVideoAbuse, 'countReports' | 'nthReport'> | 65 | export type UserVideoAbuse = Omit<AdminVideoAbuse, 'countReports' | 'nthReport'> |