diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-26 10:55:40 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | 418d092afa81e2c8fe8ac6838fc4b5eb0af6a782 (patch) | |
tree | 5e9bc5604fd5d66a006cfebb7acdbdd5486e5d1e /server/lib/activitypub/send/send-delete.ts | |
parent | b427febb4d5cebf03b815bca2c59af6e82491569 (diff) | |
download | PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.tar.gz PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.tar.zst PeerTube-418d092afa81e2c8fe8ac6838fc4b5eb0af6a782.zip |
Playlist server API
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 | // --------------------------------------------------------------------------- |