diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-16 13:49:09 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-16 13:57:14 +0100 |
commit | 19149d45b8f68569535f7188ef25e09e3d62c8b4 (patch) | |
tree | 92da0e0db2b0e277b2110a630f502433c86c9119 /shared/extra-utils/videos/video-comments.ts | |
parent | 8872828d59a5152e27734711ae30ebe86e84f570 (diff) | |
parent | f1273314593a4a7dc7ec9594ce0c6c3ae8f62b34 (diff) | |
download | PeerTube-19149d45b8f68569535f7188ef25e09e3d62c8b4.tar.gz PeerTube-19149d45b8f68569535f7188ef25e09e3d62c8b4.tar.zst PeerTube-19149d45b8f68569535f7188ef25e09e3d62c8b4.zip |
Merge branch 'feature/admin-comments' into develop
Diffstat (limited to 'shared/extra-utils/videos/video-comments.ts')
-rw-r--r-- | shared/extra-utils/videos/video-comments.ts | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/shared/extra-utils/videos/video-comments.ts b/shared/extra-utils/videos/video-comments.ts index 831e5e7d4..0b0df81dc 100644 --- a/shared/extra-utils/videos/video-comments.ts +++ b/shared/extra-utils/videos/video-comments.ts | |||
@@ -1,7 +1,41 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-floating-promises */ | 1 | /* eslint-disable @typescript-eslint/no-floating-promises */ |
2 | 2 | ||
3 | import * as request from 'supertest' | 3 | import * as request from 'supertest' |
4 | import { makeDeleteRequest } from '../requests/requests' | 4 | import { makeDeleteRequest, makeGetRequest } from '../requests/requests' |
5 | |||
6 | function getAdminVideoComments (options: { | ||
7 | url: string | ||
8 | token: string | ||
9 | start: number | ||
10 | count: number | ||
11 | sort?: string | ||
12 | isLocal?: boolean | ||
13 | search?: string | ||
14 | searchAccount?: string | ||
15 | searchVideo?: string | ||
16 | }) { | ||
17 | const { url, token, start, count, sort, isLocal, search, searchAccount, searchVideo } = options | ||
18 | const path = '/api/v1/videos/comments' | ||
19 | |||
20 | const query = { | ||
21 | start, | ||
22 | count, | ||
23 | sort: sort || '-createdAt' | ||
24 | } | ||
25 | |||
26 | if (isLocal !== undefined) Object.assign(query, { isLocal }) | ||
27 | if (search !== undefined) Object.assign(query, { search }) | ||
28 | if (searchAccount !== undefined) Object.assign(query, { searchAccount }) | ||
29 | if (searchVideo !== undefined) Object.assign(query, { searchVideo }) | ||
30 | |||
31 | return makeGetRequest({ | ||
32 | url, | ||
33 | path, | ||
34 | token, | ||
35 | query, | ||
36 | statusCodeExpected: 200 | ||
37 | }) | ||
38 | } | ||
5 | 39 | ||
6 | function getVideoCommentThreads (url: string, videoId: number | string, start: number, count: number, sort?: string, token?: string) { | 40 | function getVideoCommentThreads (url: string, videoId: number | string, start: number, count: number, sort?: string, token?: string) { |
7 | const path = '/api/v1/videos/' + videoId + '/comment-threads' | 41 | const path = '/api/v1/videos/' + videoId + '/comment-threads' |
@@ -88,6 +122,7 @@ function deleteVideoComment ( | |||
88 | 122 | ||
89 | export { | 123 | export { |
90 | getVideoCommentThreads, | 124 | getVideoCommentThreads, |
125 | getAdminVideoComments, | ||
91 | getVideoThreadComments, | 126 | getVideoThreadComments, |
92 | addVideoCommentThread, | 127 | addVideoCommentThread, |
93 | addVideoCommentReply, | 128 | addVideoCommentReply, |