diff options
Diffstat (limited to 'server/lib/activitypub/send/send-delete.ts')
-rw-r--r-- | server/lib/activitypub/send/send-delete.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts index 18969433a..016811e60 100644 --- a/server/lib/activitypub/send/send-delete.ts +++ b/server/lib/activitypub/send/send-delete.ts | |||
@@ -8,6 +8,8 @@ import { getDeleteActivityPubUrl } from '../url' | |||
8 | import { broadcastToActors, broadcastToFollowers, sendVideoRelatedActivity, 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 | import { VideoPlaylistModel } from '../../../models/video/video-playlist' | ||
12 | import { getServerActor } from '../../../helpers/utils' | ||
11 | 13 | ||
12 | async function sendDeleteVideo (video: VideoModel, transaction: Transaction) { | 14 | async function sendDeleteVideo (video: VideoModel, transaction: Transaction) { |
13 | logger.info('Creating job to broadcast delete of video %s.', video.url) | 15 | logger.info('Creating job to broadcast delete of video %s.', video.url) |
@@ -64,12 +66,29 @@ async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Trans | |||
64 | return unicastTo(activity, byActor, videoComment.Video.VideoChannel.Account.Actor.sharedInboxUrl) | 66 | return unicastTo(activity, byActor, videoComment.Video.VideoChannel.Account.Actor.sharedInboxUrl) |
65 | } | 67 | } |
66 | 68 | ||
69 | async function sendDeleteVideoPlaylist (videoPlaylist: VideoPlaylistModel, t: Transaction) { | ||
70 | logger.info('Creating job to send delete of playlist %s.', videoPlaylist.url) | ||
71 | |||
72 | const byActor = videoPlaylist.OwnerAccount.Actor | ||
73 | |||
74 | const url = getDeleteActivityPubUrl(videoPlaylist.url) | ||
75 | const activity = buildDeleteActivity(url, videoPlaylist.url, byActor) | ||
76 | |||
77 | const serverActor = await getServerActor() | ||
78 | const toFollowersOf = [ byActor, serverActor ] | ||
79 | |||
80 | if (videoPlaylist.VideoChannel) toFollowersOf.push(videoPlaylist.VideoChannel.Actor) | ||
81 | |||
82 | return broadcastToFollowers(activity, byActor, toFollowersOf, t) | ||
83 | } | ||
84 | |||
67 | // --------------------------------------------------------------------------- | 85 | // --------------------------------------------------------------------------- |
68 | 86 | ||
69 | export { | 87 | export { |
70 | sendDeleteVideo, | 88 | sendDeleteVideo, |
71 | sendDeleteActor, | 89 | sendDeleteActor, |
72 | sendDeleteVideoComment | 90 | sendDeleteVideoComment, |
91 | sendDeleteVideoPlaylist | ||
73 | } | 92 | } |
74 | 93 | ||
75 | // --------------------------------------------------------------------------- | 94 | // --------------------------------------------------------------------------- |