diff options
Diffstat (limited to 'server/lib/activitypub/send/send-create.ts')
-rw-r--r-- | server/lib/activitypub/send/send-create.ts | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts index 2f5cdc8c5..e2ee639d9 100644 --- a/server/lib/activitypub/send/send-create.ts +++ b/server/lib/activitypub/send/send-create.ts | |||
@@ -8,7 +8,8 @@ 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, broadcastToFollowers, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, getOriginVideoAudience, | 11 | audiencify, broadcastToFollowers, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, |
12 | getOriginVideoAudience, getOriginVideoCommentAudience, | ||
12 | unicastTo | 13 | unicastTo |
13 | } from './misc' | 14 | } from './misc' |
14 | 15 | ||
@@ -35,11 +36,12 @@ async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, | |||
35 | 36 | ||
36 | async function sendCreateVideoCommentToOrigin (comment: VideoCommentModel, t: Transaction) { | 37 | async function sendCreateVideoCommentToOrigin (comment: VideoCommentModel, t: Transaction) { |
37 | const byActor = comment.Account.Actor | 38 | const byActor = comment.Account.Actor |
39 | const threadParentComments = await VideoCommentModel.listThreadParentComments(comment, t) | ||
40 | const commentObject = comment.toActivityPubObject(threadParentComments) | ||
38 | 41 | ||
39 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(comment.Video, t) | 42 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(comment.Video, t) |
40 | const audience = getOriginVideoAudience(comment.Video, actorsInvolvedInVideo) | 43 | const audience = getOriginVideoCommentAudience(comment, threadParentComments, actorsInvolvedInVideo) |
41 | 44 | ||
42 | const commentObject = comment.toActivityPubObject() | ||
43 | const data = await createActivityData(comment.url, byActor, commentObject, t, audience) | 45 | const data = await createActivityData(comment.url, byActor, commentObject, t, audience) |
44 | 46 | ||
45 | return unicastTo(data, byActor, comment.Video.VideoChannel.Account.Actor.sharedInboxUrl, t) | 47 | return unicastTo(data, byActor, comment.Video.VideoChannel.Account.Actor.sharedInboxUrl, t) |
@@ -47,15 +49,15 @@ async function sendCreateVideoCommentToOrigin (comment: VideoCommentModel, t: Tr | |||
47 | 49 | ||
48 | async function sendCreateVideoCommentToVideoFollowers (comment: VideoCommentModel, t: Transaction) { | 50 | async function sendCreateVideoCommentToVideoFollowers (comment: VideoCommentModel, t: Transaction) { |
49 | const byActor = comment.Account.Actor | 51 | const byActor = comment.Account.Actor |
52 | const threadParentComments = await VideoCommentModel.listThreadParentComments(comment, t) | ||
53 | const commentObject = comment.toActivityPubObject(threadParentComments) | ||
50 | 54 | ||
51 | const actorsToForwardView = await getActorsInvolvedInVideo(comment.Video, t) | 55 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(comment.Video, t) |
52 | const audience = getObjectFollowersAudience(actorsToForwardView) | 56 | const audience = getOriginVideoCommentAudience(comment, threadParentComments, actorsInvolvedInVideo) |
53 | |||
54 | const commentObject = comment.toActivityPubObject() | ||
55 | const data = await createActivityData(comment.url, byActor, commentObject, t, audience) | 57 | const data = await createActivityData(comment.url, byActor, commentObject, t, audience) |
56 | 58 | ||
57 | const followersException = [ byActor ] | 59 | const followersException = [ byActor ] |
58 | return broadcastToFollowers(data, byActor, actorsToForwardView, t, followersException) | 60 | return broadcastToFollowers(data, byActor, actorsInvolvedInVideo, t, followersException) |
59 | } | 61 | } |
60 | 62 | ||
61 | async function sendCreateViewToOrigin (byActor: ActorModel, video: VideoModel, t: Transaction) { | 63 | async function sendCreateViewToOrigin (byActor: ActorModel, video: VideoModel, t: Transaction) { |