diff options
Diffstat (limited to 'server/lib/activitypub/send')
-rw-r--r-- | server/lib/activitypub/send/shared/audience-utils.ts | 6 | ||||
-rw-r--r-- | server/lib/activitypub/send/shared/send-utils.ts | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/server/lib/activitypub/send/shared/audience-utils.ts b/server/lib/activitypub/send/shared/audience-utils.ts index ba4be487c..2f6b0741d 100644 --- a/server/lib/activitypub/send/shared/audience-utils.ts +++ b/server/lib/activitypub/send/shared/audience-utils.ts | |||
@@ -3,7 +3,7 @@ import { ACTIVITY_PUB } from '@server/initializers/constants' | |||
3 | import { ActorModel } from '@server/models/actor/actor' | 3 | import { ActorModel } from '@server/models/actor/actor' |
4 | import { VideoModel } from '@server/models/video/video' | 4 | import { VideoModel } from '@server/models/video/video' |
5 | import { VideoShareModel } from '@server/models/video/video-share' | 5 | import { VideoShareModel } from '@server/models/video/video-share' |
6 | import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '@server/types/models' | 6 | import { MActorFollowersUrl, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '@server/types/models' |
7 | import { ActivityAudience } from '@shared/models' | 7 | import { ActivityAudience } from '@shared/models' |
8 | 8 | ||
9 | function getOriginVideoAudience (accountActor: MActorUrl, actorsInvolvedInVideo: MActorFollowersUrl[] = []): ActivityAudience { | 9 | function getOriginVideoAudience (accountActor: MActorUrl, actorsInvolvedInVideo: MActorFollowersUrl[] = []): ActivityAudience { |
@@ -51,13 +51,13 @@ function getAudienceFromFollowersOf (actorsInvolvedInObject: MActorFollowersUrl[ | |||
51 | } | 51 | } |
52 | 52 | ||
53 | async function getActorsInvolvedInVideo (video: MVideoId, t: Transaction) { | 53 | async function getActorsInvolvedInVideo (video: MVideoId, t: Transaction) { |
54 | const actors: MActorLight[] = await VideoShareModel.loadActorsByShare(video.id, t) | 54 | const actors = await VideoShareModel.listActorIdsAndFollowerUrlsByShare(video.id, t) |
55 | 55 | ||
56 | const videoAll = video as VideoModel | 56 | const videoAll = video as VideoModel |
57 | 57 | ||
58 | const videoActor = videoAll.VideoChannel?.Account | 58 | const videoActor = videoAll.VideoChannel?.Account |
59 | ? videoAll.VideoChannel.Account.Actor | 59 | ? videoAll.VideoChannel.Account.Actor |
60 | : await ActorModel.loadFromAccountByVideoId(video.id, t) | 60 | : await ActorModel.loadAccountActorFollowerUrlByVideoId(video.id, t) |
61 | 61 | ||
62 | actors.push(videoActor) | 62 | actors.push(videoActor) |
63 | 63 | ||
diff --git a/server/lib/activitypub/send/shared/send-utils.ts b/server/lib/activitypub/send/shared/send-utils.ts index dbcde91ee..72368c762 100644 --- a/server/lib/activitypub/send/shared/send-utils.ts +++ b/server/lib/activitypub/send/shared/send-utils.ts | |||
@@ -19,13 +19,13 @@ async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAud | |||
19 | }) { | 19 | }) { |
20 | const { byActor, video, transaction, contextType } = options | 20 | const { byActor, video, transaction, contextType } = options |
21 | 21 | ||
22 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, transaction) | ||
23 | |||
24 | // Send to origin | 22 | // Send to origin |
25 | if (video.isOwned() === false) { | 23 | if (video.isOwned() === false) { |
26 | return sendVideoActivityToOrigin(activityBuilder, options) | 24 | return sendVideoActivityToOrigin(activityBuilder, options) |
27 | } | 25 | } |
28 | 26 | ||
27 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, transaction) | ||
28 | |||
29 | // Send to followers | 29 | // Send to followers |
30 | const audience = getAudienceFromFollowersOf(actorsInvolvedInVideo) | 30 | const audience = getAudienceFromFollowersOf(actorsInvolvedInVideo) |
31 | const activity = activityBuilder(audience) | 31 | const activity = activityBuilder(audience) |