diff options
Diffstat (limited to 'server/lib/activitypub/send/send-create.ts')
-rw-r--r-- | server/lib/activitypub/send/send-create.ts | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts index 9db663be1..b92615e9b 100644 --- a/server/lib/activitypub/send/send-create.ts +++ b/server/lib/activitypub/send/send-create.ts | |||
@@ -8,8 +8,14 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse' | |||
8 | import { VideoCommentModel } from '../../../models/video/video-comment' | 8 | import { VideoCommentModel } from '../../../models/video/video-comment' |
9 | import { getVideoAbuseActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoViewActivityPubUrl } from '../url' | 9 | import { getVideoAbuseActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoViewActivityPubUrl } from '../url' |
10 | import { | 10 | import { |
11 | audiencify, broadcastToActors, broadcastToFollowers, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, | 11 | audiencify, |
12 | getOriginVideoAudience, getOriginVideoCommentAudience, | 12 | broadcastToActors, |
13 | broadcastToFollowers, | ||
14 | getActorsInvolvedInVideo, | ||
15 | getAudience, | ||
16 | getObjectFollowersAudience, | ||
17 | getOriginVideoAudience, | ||
18 | getOriginVideoCommentAudience, | ||
13 | unicastTo | 19 | unicastTo |
14 | } from './misc' | 20 | } from './misc' |
15 | 21 | ||
@@ -31,7 +37,7 @@ async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, | |||
31 | const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] } | 37 | const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] } |
32 | const data = await createActivityData(url, byActor, videoAbuse.toActivityPubObject(), t, audience) | 38 | const data = await createActivityData(url, byActor, videoAbuse.toActivityPubObject(), t, audience) |
33 | 39 | ||
34 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl, t) | 40 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) |
35 | } | 41 | } |
36 | 42 | ||
37 | async function sendCreateVideoCommentToOrigin (comment: VideoCommentModel, t: Transaction) { | 43 | async function sendCreateVideoCommentToOrigin (comment: VideoCommentModel, t: Transaction) { |
@@ -47,13 +53,13 @@ async function sendCreateVideoCommentToOrigin (comment: VideoCommentModel, t: Tr | |||
47 | 53 | ||
48 | // This was a reply, send it to the parent actors | 54 | // This was a reply, send it to the parent actors |
49 | const actorsException = [ byActor ] | 55 | const actorsException = [ byActor ] |
50 | await broadcastToActors(data, byActor, threadParentComments.map(c => c.Account.Actor), t, actorsException) | 56 | await broadcastToActors(data, byActor, threadParentComments.map(c => c.Account.Actor), actorsException) |
51 | 57 | ||
52 | // Broadcast to our followers | 58 | // Broadcast to our followers |
53 | await broadcastToFollowers(data, byActor, [ byActor ], t) | 59 | await broadcastToFollowers(data, byActor, [ byActor ], t) |
54 | 60 | ||
55 | // Send to origin | 61 | // Send to origin |
56 | return unicastTo(data, byActor, comment.Video.VideoChannel.Account.Actor.sharedInboxUrl, t) | 62 | return unicastTo(data, byActor, comment.Video.VideoChannel.Account.Actor.sharedInboxUrl) |
57 | } | 63 | } |
58 | 64 | ||
59 | async function sendCreateVideoCommentToVideoFollowers (comment: VideoCommentModel, t: Transaction) { | 65 | async function sendCreateVideoCommentToVideoFollowers (comment: VideoCommentModel, t: Transaction) { |
@@ -69,7 +75,7 @@ async function sendCreateVideoCommentToVideoFollowers (comment: VideoCommentMode | |||
69 | 75 | ||
70 | // This was a reply, send it to the parent actors | 76 | // This was a reply, send it to the parent actors |
71 | const actorsException = [ byActor ] | 77 | const actorsException = [ byActor ] |
72 | await broadcastToActors(data, byActor, threadParentComments.map(c => c.Account.Actor), t, actorsException) | 78 | await broadcastToActors(data, byActor, threadParentComments.map(c => c.Account.Actor), actorsException) |
73 | 79 | ||
74 | // Broadcast to our followers | 80 | // Broadcast to our followers |
75 | await broadcastToFollowers(data, byActor, [ byActor ], t) | 81 | await broadcastToFollowers(data, byActor, [ byActor ], t) |
@@ -86,7 +92,7 @@ async function sendCreateViewToOrigin (byActor: ActorModel, video: VideoModel, t | |||
86 | const audience = getOriginVideoAudience(video, actorsInvolvedInVideo) | 92 | const audience = getOriginVideoAudience(video, actorsInvolvedInVideo) |
87 | const data = await createActivityData(url, byActor, viewActivityData, t, audience) | 93 | const data = await createActivityData(url, byActor, viewActivityData, t, audience) |
88 | 94 | ||
89 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl, t) | 95 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) |
90 | } | 96 | } |
91 | 97 | ||
92 | async function sendCreateViewToVideoFollowers (byActor: ActorModel, video: VideoModel, t: Transaction) { | 98 | async function sendCreateViewToVideoFollowers (byActor: ActorModel, video: VideoModel, t: Transaction) { |
@@ -111,7 +117,7 @@ async function sendCreateDislikeToOrigin (byActor: ActorModel, video: VideoModel | |||
111 | const audience = getOriginVideoAudience(video, actorsInvolvedInVideo) | 117 | const audience = getOriginVideoAudience(video, actorsInvolvedInVideo) |
112 | const data = await createActivityData(url, byActor, dislikeActivityData, t, audience) | 118 | const data = await createActivityData(url, byActor, dislikeActivityData, t, audience) |
113 | 119 | ||
114 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl, t) | 120 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) |
115 | } | 121 | } |
116 | 122 | ||
117 | async function sendCreateDislikeToVideoFollowers (byActor: ActorModel, video: VideoModel, t: Transaction) { | 123 | async function sendCreateDislikeToVideoFollowers (byActor: ActorModel, video: VideoModel, t: Transaction) { |