aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/core-utils/users/user-role.ts3
-rw-r--r--shared/extra-utils/videos/video-comments.ts37
-rw-r--r--shared/models/users/user-right.enum.ts1
-rw-r--r--shared/models/videos/video-comment.model.ts20
4 files changed, 59 insertions, 2 deletions
diff --git a/shared/core-utils/users/user-role.ts b/shared/core-utils/users/user-role.ts
index 2b322faf3..81cba1dad 100644
--- a/shared/core-utils/users/user-role.ts
+++ b/shared/core-utils/users/user-role.ts
@@ -22,7 +22,8 @@ const userRoleRights: { [ id in UserRole ]: UserRight[] } = {
22 UserRight.SEE_ALL_VIDEOS, 22 UserRight.SEE_ALL_VIDEOS,
23 UserRight.MANAGE_ACCOUNTS_BLOCKLIST, 23 UserRight.MANAGE_ACCOUNTS_BLOCKLIST,
24 UserRight.MANAGE_SERVERS_BLOCKLIST, 24 UserRight.MANAGE_SERVERS_BLOCKLIST,
25 UserRight.MANAGE_USERS 25 UserRight.MANAGE_USERS,
26 UserRight.SEE_ALL_COMMENTS
26 ], 27 ],
27 28
28 [UserRole.USER]: [] 29 [UserRole.USER]: []
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
3import * as request from 'supertest' 3import * as request from 'supertest'
4import { makeDeleteRequest } from '../requests/requests' 4import { makeDeleteRequest, makeGetRequest } from '../requests/requests'
5
6function 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
6function getVideoCommentThreads (url: string, videoId: number | string, start: number, count: number, sort?: string, token?: string) { 40function 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
89export { 123export {
90 getVideoCommentThreads, 124 getVideoCommentThreads,
125 getAdminVideoComments,
91 getVideoThreadComments, 126 getVideoThreadComments,
92 addVideoCommentThread, 127 addVideoCommentThread,
93 addVideoCommentReply, 128 addVideoCommentReply,
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts
index e815fa893..bbedc9f00 100644
--- a/shared/models/users/user-right.enum.ts
+++ b/shared/models/users/user-right.enum.ts
@@ -32,6 +32,7 @@ export const enum UserRight {
32 32
33 GET_ANY_LIVE, 33 GET_ANY_LIVE,
34 SEE_ALL_VIDEOS, 34 SEE_ALL_VIDEOS,
35 SEE_ALL_COMMENTS,
35 CHANGE_VIDEO_OWNERSHIP, 36 CHANGE_VIDEO_OWNERSHIP,
36 37
37 MANAGE_PLUGINS, 38 MANAGE_PLUGINS,
diff --git a/shared/models/videos/video-comment.model.ts b/shared/models/videos/video-comment.model.ts
index eec7dba1c..9730a3f76 100644
--- a/shared/models/videos/video-comment.model.ts
+++ b/shared/models/videos/video-comment.model.ts
@@ -16,6 +16,26 @@ export interface VideoComment {
16 account: Account 16 account: Account
17} 17}
18 18
19export interface VideoCommentAdmin {
20 id: number
21 url: string
22 text: string
23
24 threadId: number
25 inReplyToCommentId: number
26
27 createdAt: Date | string
28 updatedAt: Date | string
29
30 account: Account
31
32 video: {
33 id: number
34 uuid: string
35 name: string
36 }
37}
38
19export interface VideoCommentThreadTree { 39export interface VideoCommentThreadTree {
20 comment: VideoComment 40 comment: VideoComment
21 children: VideoCommentThreadTree[] 41 children: VideoCommentThreadTree[]