PeerTube/server/lib/moderation.ts

65 lines
1.8 KiB
TypeScript
Raw Normal View History

2019-07-18 14:28:37 +02:00
import { VideoModel } from '../models/video/video'
import { VideoCommentModel } from '../models/video/video-comment'
import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model'
import { VideoCreate } from '../../shared/models/videos'
import { UserModel } from '../models/account/user'
import { VideoTorrentObject } from '../../shared/models/activitypub/objects'
import { ActivityCreate } from '../../shared/models/activitypub'
import { ActorModel } from '../models/activitypub/actor'
import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
export type AcceptResult = {
accepted: boolean
errorMessage?: string
}
// Can be filtered by plugins
function isLocalVideoAccepted (object: {
2020-01-31 16:56:52 +01:00
videoBody: VideoCreate
videoFile: Express.Multer.File & { duration?: number }
2019-07-18 14:28:37 +02:00
user: UserModel
}): AcceptResult {
return { accepted: true }
}
function isLocalVideoThreadAccepted (_object: {
2020-01-31 16:56:52 +01:00
commentBody: VideoCommentCreate
video: VideoModel
2019-07-18 14:28:37 +02:00
user: UserModel
}): AcceptResult {
return { accepted: true }
}
function isLocalVideoCommentReplyAccepted (_object: {
2020-01-31 16:56:52 +01:00
commentBody: VideoCommentCreate
parentComment: VideoCommentModel
video: VideoModel
2019-07-18 14:28:37 +02:00
user: UserModel
}): AcceptResult {
return { accepted: true }
}
function isRemoteVideoAccepted (_object: {
2020-01-31 16:56:52 +01:00
activity: ActivityCreate
videoAP: VideoTorrentObject
2019-07-18 14:28:37 +02:00
byActor: ActorModel
}): AcceptResult {
return { accepted: true }
}
function isRemoteVideoCommentAccepted (_object: {
2020-01-31 16:56:52 +01:00
activity: ActivityCreate
commentAP: VideoCommentObject
2019-07-18 14:28:37 +02:00
byActor: ActorModel
}): AcceptResult {
return { accepted: true }
}
export {
isLocalVideoAccepted,
isLocalVideoThreadAccepted,
isRemoteVideoAccepted,
isRemoteVideoCommentAccepted,
isLocalVideoCommentReplyAccepted
}