]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/lib/moderation.ts
Merge branch 'master' into develop
[github/Chocobozzz/PeerTube.git] / server / lib / moderation.ts
1 import { VideoModel } from '../models/video/video'
2 import { VideoCommentModel } from '../models/video/video-comment'
3 import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model'
4 import { VideoCreate } from '../../shared/models/videos'
5 import { UserModel } from '../models/account/user'
6 import { VideoTorrentObject } from '../../shared/models/activitypub/objects'
7 import { ActivityCreate } from '../../shared/models/activitypub'
8 import { ActorModel } from '../models/activitypub/actor'
9 import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
10
11 export type AcceptResult = {
12 accepted: boolean
13 errorMessage?: string
14 }
15
16 // Can be filtered by plugins
17 function isLocalVideoAccepted (object: {
18 videoBody: VideoCreate
19 videoFile: Express.Multer.File & { duration?: number }
20 user: UserModel
21 }): AcceptResult {
22 return { accepted: true }
23 }
24
25 function isLocalVideoThreadAccepted (_object: {
26 commentBody: VideoCommentCreate
27 video: VideoModel
28 user: UserModel
29 }): AcceptResult {
30 return { accepted: true }
31 }
32
33 function isLocalVideoCommentReplyAccepted (_object: {
34 commentBody: VideoCommentCreate
35 parentComment: VideoCommentModel
36 video: VideoModel
37 user: UserModel
38 }): AcceptResult {
39 return { accepted: true }
40 }
41
42 function isRemoteVideoAccepted (_object: {
43 activity: ActivityCreate
44 videoAP: VideoTorrentObject
45 byActor: ActorModel
46 }): AcceptResult {
47 return { accepted: true }
48 }
49
50 function isRemoteVideoCommentAccepted (_object: {
51 activity: ActivityCreate
52 commentAP: VideoCommentObject
53 byActor: ActorModel
54 }): AcceptResult {
55 return { accepted: true }
56 }
57
58 export {
59 isLocalVideoAccepted,
60 isLocalVideoThreadAccepted,
61 isRemoteVideoAccepted,
62 isRemoteVideoCommentAccepted,
63 isLocalVideoCommentReplyAccepted
64 }