diff options
Diffstat (limited to 'server/lib/activitypub/send')
-rw-r--r-- | server/lib/activitypub/send/send-delete.ts | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts index 1ca031898..995a534a6 100644 --- a/server/lib/activitypub/send/send-delete.ts +++ b/server/lib/activitypub/send/send-delete.ts | |||
@@ -4,12 +4,14 @@ import { ActorModel } from '../../../models/activitypub/actor' | |||
4 | import { VideoModel } from '../../../models/video/video' | 4 | 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 { broadcastToFollowers } from './misc' | 8 | import { broadcastToFollowers } from './misc' |
8 | 9 | ||
9 | async function sendDeleteVideo (video: VideoModel, t: Transaction) { | 10 | async function sendDeleteVideo (video: VideoModel, t: Transaction) { |
11 | const url = getDeleteActivityPubUrl(video.url) | ||
10 | const byActor = video.VideoChannel.Account.Actor | 12 | const byActor = video.VideoChannel.Account.Actor |
11 | 13 | ||
12 | const data = deleteActivityData(video.url, byActor) | 14 | const data = deleteActivityData(url, video.url, byActor) |
13 | 15 | ||
14 | const actorsInvolved = await VideoShareModel.loadActorsByShare(video.id, t) | 16 | const actorsInvolved = await VideoShareModel.loadActorsByShare(video.id, t) |
15 | actorsInvolved.push(byActor) | 17 | actorsInvolved.push(byActor) |
@@ -18,15 +20,17 @@ async function sendDeleteVideo (video: VideoModel, t: Transaction) { | |||
18 | } | 20 | } |
19 | 21 | ||
20 | async function sendDeleteActor (byActor: ActorModel, t: Transaction) { | 22 | async function sendDeleteActor (byActor: ActorModel, t: Transaction) { |
21 | const data = deleteActivityData(byActor.url, byActor) | 23 | const url = getDeleteActivityPubUrl(byActor.url) |
24 | const data = deleteActivityData(url, byActor.url, byActor) | ||
22 | 25 | ||
23 | return broadcastToFollowers(data, byActor, [ byActor ], t) | 26 | return broadcastToFollowers(data, byActor, [ byActor ], t) |
24 | } | 27 | } |
25 | 28 | ||
26 | async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Transaction) { | 29 | async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Transaction) { |
27 | const byActor = videoComment.Account.Actor | 30 | const url = getDeleteActivityPubUrl(videoComment.url) |
28 | 31 | ||
29 | const data = deleteActivityData(videoComment.url, byActor) | 32 | const byActor = videoComment.Account.Actor |
33 | const data = deleteActivityData(url, videoComment.url, byActor) | ||
30 | 34 | ||
31 | const actorsInvolved = await VideoShareModel.loadActorsByShare(videoComment.Video.id, t) | 35 | const actorsInvolved = await VideoShareModel.loadActorsByShare(videoComment.Video.id, t) |
32 | actorsInvolved.push(videoComment.Video.VideoChannel.Account.Actor) | 36 | actorsInvolved.push(videoComment.Video.VideoChannel.Account.Actor) |
@@ -45,10 +49,11 @@ export { | |||
45 | 49 | ||
46 | // --------------------------------------------------------------------------- | 50 | // --------------------------------------------------------------------------- |
47 | 51 | ||
48 | function deleteActivityData (url: string, byActor: ActorModel): ActivityDelete { | 52 | function deleteActivityData (url: string, object: string, byActor: ActorModel): ActivityDelete { |
49 | return { | 53 | return { |
50 | type: 'Delete', | 54 | type: 'Delete', |
51 | id: url, | 55 | id: url, |
52 | actor: byActor.url | 56 | actor: byActor.url, |
57 | object | ||
53 | } | 58 | } |
54 | } | 59 | } |