+function isPreImportVideoAccepted (object: {
+ videoImportBody: VideoImportCreate
+ user: MUser
+}): AcceptResult {
+ return { accepted: true }
+}
+
+function isPostImportVideoAccepted (object: {
+ videoFilePath: PathLike
+ videoFile: VideoFileModel
+ user: MUser
+}): AcceptResult {
+ return { accepted: true }
+}
+
+async function createVideoAbuse (options: {
+ baseAbuse: FilteredModelAttributes<AbuseModel>
+ videoInstance: MVideoAccountLightBlacklistAllFiles
+ startAt: number
+ endAt: number
+ transaction: Transaction
+ reporterAccount: MAccountDefault
+}) {
+ const { baseAbuse, videoInstance, startAt, endAt, transaction, reporterAccount } = options
+
+ const associateFun = async (abuseInstance: MAbuseFull) => {
+ const videoAbuseInstance: MVideoAbuseVideoFull = await VideoAbuseModel.create({
+ abuseId: abuseInstance.id,
+ videoId: videoInstance.id,
+ startAt: startAt,
+ endAt: endAt
+ }, { transaction })
+
+ videoAbuseInstance.Video = videoInstance
+ abuseInstance.VideoAbuse = videoAbuseInstance
+
+ return { isOwned: videoInstance.isOwned() }
+ }
+
+ return createAbuse({
+ base: baseAbuse,
+ reporterAccount,
+ flaggedAccount: videoInstance.VideoChannel.Account,
+ transaction,
+ associateFun
+ })
+}
+
+function createVideoCommentAbuse (options: {
+ baseAbuse: FilteredModelAttributes<AbuseModel>
+ commentInstance: MCommentOwnerVideo
+ transaction: Transaction
+ reporterAccount: MAccountDefault
+}) {
+ const { baseAbuse, commentInstance, transaction, reporterAccount } = options
+
+ const associateFun = async (abuseInstance: MAbuseFull) => {
+ const commentAbuseInstance: MCommentAbuseAccountVideo = await VideoCommentAbuseModel.create({
+ abuseId: abuseInstance.id,
+ videoCommentId: commentInstance.id
+ }, { transaction })
+
+ commentAbuseInstance.VideoComment = commentInstance
+ abuseInstance.VideoCommentAbuse = commentAbuseInstance
+
+ return { isOwned: commentInstance.isOwned() }
+ }
+
+ return createAbuse({
+ base: baseAbuse,
+ reporterAccount,
+ flaggedAccount: commentInstance.Account,
+ transaction,
+ associateFun
+ })
+}
+
+function createAccountAbuse (options: {
+ baseAbuse: FilteredModelAttributes<AbuseModel>
+ accountInstance: MAccountDefault
+ transaction: Transaction
+ reporterAccount: MAccountDefault
+}) {
+ const { baseAbuse, accountInstance, transaction, reporterAccount } = options
+
+ const associateFun = async () => {
+ return { isOwned: accountInstance.isOwned() }
+ }
+
+ return createAbuse({
+ base: baseAbuse,
+ reporterAccount,
+ flaggedAccount: accountInstance,
+ transaction,
+ associateFun
+ })
+}
+