1 import { Transaction } from 'sequelize'
2 import { ActivityDelete } from '../../../../shared/models/activitypub'
3 import { ActorModel } from '../../../models/activitypub/actor'
4 import { VideoModel } from '../../../models/video/video'
5 import { VideoCommentModel } from '../../../models/video/video-comment'
6 import { VideoShareModel } from '../../../models/video/video-share'
7 import { broadcastToFollowers } from './misc'
9 async function sendDeleteVideo (video: VideoModel, t: Transaction) {
10 const byActor = video.VideoChannel.Account.Actor
12 const data = deleteActivityData(video.url, byActor)
14 const actorsInvolved = await VideoShareModel.loadActorsByShare(video.id, t)
15 actorsInvolved.push(byActor)
17 return broadcastToFollowers(data, byActor, actorsInvolved, t)
20 async function sendDeleteActor (byActor: ActorModel, t: Transaction) {
21 const data = deleteActivityData(byActor.url, byActor)
23 return broadcastToFollowers(data, byActor, [ byActor ], t)
26 async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Transaction) {
27 const byActor = videoComment.Account.Actor
29 const data = deleteActivityData(videoComment.url, byActor)
31 const actorsInvolved = await VideoShareModel.loadActorsByShare(videoComment.Video.id, t)
32 actorsInvolved.push(videoComment.Video.VideoChannel.Account.Actor)
33 actorsInvolved.push(byActor)
35 return broadcastToFollowers(data, byActor, actorsInvolved, t)
38 // ---------------------------------------------------------------------------
43 sendDeleteVideoComment
46 // ---------------------------------------------------------------------------
48 function deleteActivityData (url: string, byActor: ActorModel): ActivityDelete {