aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/moderation.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/moderation.ts')
-rw-r--r--server/lib/moderation.ts38
1 files changed, 22 insertions, 16 deletions
diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts
index c23f5b6a6..43c58c980 100644
--- a/server/lib/moderation.ts
+++ b/server/lib/moderation.ts
@@ -13,18 +13,15 @@ import {
13 MAbuseFull, 13 MAbuseFull,
14 MAccountDefault, 14 MAccountDefault,
15 MAccountLight, 15 MAccountLight,
16 MComment,
16 MCommentAbuseAccountVideo, 17 MCommentAbuseAccountVideo,
17 MCommentOwnerVideo, 18 MCommentOwnerVideo,
18 MUser, 19 MUser,
19 MVideoAbuseVideoFull, 20 MVideoAbuseVideoFull,
20 MVideoAccountLightBlacklistAllFiles 21 MVideoAccountLightBlacklistAllFiles
21} from '@server/types/models' 22} from '@server/types/models'
22import { ActivityCreate } from '../../shared/models/activitypub'
23import { VideoObject } from '../../shared/models/activitypub/objects'
24import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
25import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos' 23import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos'
26import { VideoCommentCreate } from '../../shared/models/videos/comment' 24import { VideoCommentCreate } from '../../shared/models/videos/comment'
27import { ActorModel } from '../models/actor/actor'
28import { UserModel } from '../models/user/user' 25import { UserModel } from '../models/user/user'
29import { VideoModel } from '../models/video/video' 26import { VideoModel } from '../models/video/video'
30import { VideoCommentModel } from '../models/video/video-comment' 27import { VideoCommentModel } from '../models/video/video-comment'
@@ -36,7 +33,9 @@ export type AcceptResult = {
36 errorMessage?: string 33 errorMessage?: string
37} 34}
38 35
39// Can be filtered by plugins 36// ---------------------------------------------------------------------------
37
38// Stub function that can be filtered by plugins
40function isLocalVideoAccepted (object: { 39function isLocalVideoAccepted (object: {
41 videoBody: VideoCreate 40 videoBody: VideoCreate
42 videoFile: VideoUploadFile 41 videoFile: VideoUploadFile
@@ -45,6 +44,9 @@ function isLocalVideoAccepted (object: {
45 return { accepted: true } 44 return { accepted: true }
46} 45}
47 46
47// ---------------------------------------------------------------------------
48
49// Stub function that can be filtered by plugins
48function isLocalLiveVideoAccepted (object: { 50function isLocalLiveVideoAccepted (object: {
49 liveVideoBody: LiveVideoCreate 51 liveVideoBody: LiveVideoCreate
50 user: UserModel 52 user: UserModel
@@ -52,6 +54,9 @@ function isLocalLiveVideoAccepted (object: {
52 return { accepted: true } 54 return { accepted: true }
53} 55}
54 56
57// ---------------------------------------------------------------------------
58
59// Stub function that can be filtered by plugins
55function isLocalVideoThreadAccepted (_object: { 60function isLocalVideoThreadAccepted (_object: {
56 commentBody: VideoCommentCreate 61 commentBody: VideoCommentCreate
57 video: VideoModel 62 video: VideoModel
@@ -60,6 +65,7 @@ function isLocalVideoThreadAccepted (_object: {
60 return { accepted: true } 65 return { accepted: true }
61} 66}
62 67
68// Stub function that can be filtered by plugins
63function isLocalVideoCommentReplyAccepted (_object: { 69function isLocalVideoCommentReplyAccepted (_object: {
64 commentBody: VideoCommentCreate 70 commentBody: VideoCommentCreate
65 parentComment: VideoCommentModel 71 parentComment: VideoCommentModel
@@ -69,22 +75,18 @@ function isLocalVideoCommentReplyAccepted (_object: {
69 return { accepted: true } 75 return { accepted: true }
70} 76}
71 77
72function isRemoteVideoAccepted (_object: { 78// ---------------------------------------------------------------------------
73 activity: ActivityCreate
74 videoAP: VideoObject
75 byActor: ActorModel
76}): AcceptResult {
77 return { accepted: true }
78}
79 79
80// Stub function that can be filtered by plugins
80function isRemoteVideoCommentAccepted (_object: { 81function isRemoteVideoCommentAccepted (_object: {
81 activity: ActivityCreate 82 comment: MComment
82 commentAP: VideoCommentObject
83 byActor: ActorModel
84}): AcceptResult { 83}): AcceptResult {
85 return { accepted: true } 84 return { accepted: true }
86} 85}
87 86
87// ---------------------------------------------------------------------------
88
89// Stub function that can be filtered by plugins
88function isPreImportVideoAccepted (object: { 90function isPreImportVideoAccepted (object: {
89 videoImportBody: VideoImportCreate 91 videoImportBody: VideoImportCreate
90 user: MUser 92 user: MUser
@@ -92,6 +94,7 @@ function isPreImportVideoAccepted (object: {
92 return { accepted: true } 94 return { accepted: true }
93} 95}
94 96
97// Stub function that can be filtered by plugins
95function isPostImportVideoAccepted (object: { 98function isPostImportVideoAccepted (object: {
96 videoFilePath: PathLike 99 videoFilePath: PathLike
97 videoFile: VideoFileModel 100 videoFile: VideoFileModel
@@ -100,6 +103,8 @@ function isPostImportVideoAccepted (object: {
100 return { accepted: true } 103 return { accepted: true }
101} 104}
102 105
106// ---------------------------------------------------------------------------
107
103async function createVideoAbuse (options: { 108async function createVideoAbuse (options: {
104 baseAbuse: FilteredModelAttributes<AbuseModel> 109 baseAbuse: FilteredModelAttributes<AbuseModel>
105 videoInstance: MVideoAccountLightBlacklistAllFiles 110 videoInstance: MVideoAccountLightBlacklistAllFiles
@@ -189,12 +194,13 @@ function createAccountAbuse (options: {
189 }) 194 })
190} 195}
191 196
197// ---------------------------------------------------------------------------
198
192export { 199export {
193 isLocalLiveVideoAccepted, 200 isLocalLiveVideoAccepted,
194 201
195 isLocalVideoAccepted, 202 isLocalVideoAccepted,
196 isLocalVideoThreadAccepted, 203 isLocalVideoThreadAccepted,
197 isRemoteVideoAccepted,
198 isRemoteVideoCommentAccepted, 204 isRemoteVideoCommentAccepted,
199 isLocalVideoCommentReplyAccepted, 205 isLocalVideoCommentReplyAccepted,
200 isPreImportVideoAccepted, 206 isPreImportVideoAccepted,