diff options
Diffstat (limited to 'server/lib/activitypub/send/send-delete.ts')
-rw-r--r-- | server/lib/activitypub/send/send-delete.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts index 479182543..18969433a 100644 --- a/server/lib/activitypub/send/send-delete.ts +++ b/server/lib/activitypub/send/send-delete.ts | |||
@@ -5,21 +5,22 @@ import { VideoModel } from '../../../models/video/video' | |||
5 | import { VideoCommentModel } from '../../../models/video/video-comment' | 5 | import { VideoCommentModel } from '../../../models/video/video-comment' |
6 | import { VideoShareModel } from '../../../models/video/video-share' | 6 | import { VideoShareModel } from '../../../models/video/video-share' |
7 | import { getDeleteActivityPubUrl } from '../url' | 7 | import { getDeleteActivityPubUrl } from '../url' |
8 | import { broadcastToActors, broadcastToFollowers, unicastTo } from './utils' | 8 | import { broadcastToActors, broadcastToFollowers, sendVideoRelatedActivity, unicastTo } from './utils' |
9 | import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience' | 9 | import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience' |
10 | import { logger } from '../../../helpers/logger' | 10 | import { logger } from '../../../helpers/logger' |
11 | 11 | ||
12 | async function sendDeleteVideo (video: VideoModel, t: Transaction) { | 12 | async function sendDeleteVideo (video: VideoModel, transaction: Transaction) { |
13 | logger.info('Creating job to broadcast delete of video %s.', video.url) | 13 | logger.info('Creating job to broadcast delete of video %s.', video.url) |
14 | 14 | ||
15 | const url = getDeleteActivityPubUrl(video.url) | ||
16 | const byActor = video.VideoChannel.Account.Actor | 15 | const byActor = video.VideoChannel.Account.Actor |
17 | 16 | ||
18 | const activity = buildDeleteActivity(url, video.url, byActor) | 17 | const activityBuilder = (audience: ActivityAudience) => { |
18 | const url = getDeleteActivityPubUrl(video.url) | ||
19 | 19 | ||
20 | const actorsInvolved = await getActorsInvolvedInVideo(video, t) | 20 | return buildDeleteActivity(url, video.url, byActor, audience) |
21 | } | ||
21 | 22 | ||
22 | return broadcastToFollowers(activity, byActor, actorsInvolved, t) | 23 | return sendVideoRelatedActivity(activityBuilder, { byActor, video, transaction }) |
23 | } | 24 | } |
24 | 25 | ||
25 | async function sendDeleteActor (byActor: ActorModel, t: Transaction) { | 26 | async function sendDeleteActor (byActor: ActorModel, t: Transaction) { |