aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/moderation.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-18 14:28:37 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commitb4055e1c23eeefb0c8a85a77f312b2827d98f483 (patch)
tree51b6b04c1ad10897047817d2eaaa037d1331fa6a /server/lib/moderation.ts
parent66e001c848c009412c65cbce41be344d8985fd83 (diff)
downloadPeerTube-b4055e1c23eeefb0c8a85a77f312b2827d98f483.tar.gz
PeerTube-b4055e1c23eeefb0c8a85a77f312b2827d98f483.tar.zst
PeerTube-b4055e1c23eeefb0c8a85a77f312b2827d98f483.zip
Add server hooks
Diffstat (limited to 'server/lib/moderation.ts')
-rw-r--r--server/lib/moderation.ts64
1 files changed, 64 insertions, 0 deletions
diff --git a/server/lib/moderation.ts b/server/lib/moderation.ts
new file mode 100644
index 000000000..b609f4585
--- /dev/null
+++ b/server/lib/moderation.ts
@@ -0,0 +1,64 @@
1import { VideoModel } from '../models/video/video'
2import { VideoCommentModel } from '../models/video/video-comment'
3import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model'
4import { VideoCreate } from '../../shared/models/videos'
5import { UserModel } from '../models/account/user'
6import { VideoTorrentObject } from '../../shared/models/activitypub/objects'
7import { ActivityCreate } from '../../shared/models/activitypub'
8import { ActorModel } from '../models/activitypub/actor'
9import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
10
11export type AcceptResult = {
12 accepted: boolean
13 errorMessage?: string
14}
15
16// Can be filtered by plugins
17function isLocalVideoAccepted (object: {
18 videoBody: VideoCreate,
19 videoFile: Express.Multer.File & { duration?: number },
20 user: UserModel
21}): AcceptResult {
22 return { accepted: true }
23}
24
25function isLocalVideoThreadAccepted (_object: {
26 commentBody: VideoCommentCreate,
27 video: VideoModel,
28 user: UserModel
29}): AcceptResult {
30 return { accepted: true }
31}
32
33function isLocalVideoCommentReplyAccepted (_object: {
34 commentBody: VideoCommentCreate,
35 parentComment: VideoCommentModel,
36 video: VideoModel,
37 user: UserModel
38}): AcceptResult {
39 return { accepted: true }
40}
41
42function isRemoteVideoAccepted (_object: {
43 activity: ActivityCreate,
44 videoAP: VideoTorrentObject,
45 byActor: ActorModel
46}): AcceptResult {
47 return { accepted: true }
48}
49
50function isRemoteVideoCommentAccepted (_object: {
51 activity: ActivityCreate,
52 commentAP: VideoCommentObject,
53 byActor: ActorModel
54}): AcceptResult {
55 return { accepted: true }
56}
57
58export {
59 isLocalVideoAccepted,
60 isLocalVideoThreadAccepted,
61 isRemoteVideoAccepted,
62 isRemoteVideoCommentAccepted,
63 isLocalVideoCommentReplyAccepted
64}