diff options
Diffstat (limited to 'server/controllers/activitypub/outbox.ts')
-rw-r--r-- | server/controllers/activitypub/outbox.ts | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts index 38b6ec976..f3dd2ad7d 100644 --- a/server/controllers/activitypub/outbox.ts +++ b/server/controllers/activitypub/outbox.ts | |||
@@ -6,11 +6,9 @@ import { logger } from '../../helpers/logger' | |||
6 | import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send' | 6 | import { buildAnnounceActivity, buildCreateActivity } from '../../lib/activitypub/send' |
7 | import { buildAudience } from '../../lib/activitypub/audience' | 7 | import { buildAudience } from '../../lib/activitypub/audience' |
8 | import { asyncMiddleware, localAccountValidator, localVideoChannelValidator } from '../../middlewares' | 8 | import { asyncMiddleware, localAccountValidator, localVideoChannelValidator } from '../../middlewares' |
9 | import { AccountModel } from '../../models/account/account' | ||
10 | import { ActorModel } from '../../models/activitypub/actor' | ||
11 | import { VideoModel } from '../../models/video/video' | 9 | import { VideoModel } from '../../models/video/video' |
12 | import { activityPubResponse } from './utils' | 10 | import { activityPubResponse } from './utils' |
13 | import { VideoChannelModel } from '../../models/video/video-channel' | 11 | import { MActorLight } from '@server/typings/models' |
14 | 12 | ||
15 | const outboxRouter = express.Router() | 13 | const outboxRouter = express.Router() |
16 | 14 | ||
@@ -45,14 +43,10 @@ async function outboxController (req: express.Request, res: express.Response) { | |||
45 | return activityPubResponse(activityPubContextify(json), res) | 43 | return activityPubResponse(activityPubContextify(json), res) |
46 | } | 44 | } |
47 | 45 | ||
48 | async function buildActivities (actor: ActorModel, start: number, count: number) { | 46 | async function buildActivities (actor: MActorLight, start: number, count: number) { |
49 | const data = await VideoModel.listAllAndSharedByActorForOutbox(actor.id, start, count) | 47 | const data = await VideoModel.listAllAndSharedByActorForOutbox(actor.id, start, count) |
50 | const activities: Activity[] = [] | 48 | const activities: Activity[] = [] |
51 | 49 | ||
52 | // Avoid too many SQL requests | ||
53 | const actors = data.data.map(v => v.VideoChannel.Account.Actor) | ||
54 | actors.push(actor) | ||
55 | |||
56 | for (const video of data.data) { | 50 | for (const video of data.data) { |
57 | const byActor = video.VideoChannel.Account.Actor | 51 | const byActor = video.VideoChannel.Account.Actor |
58 | const createActivityAudience = buildAudience([ byActor.followersUrl ], video.privacy === VideoPrivacy.PUBLIC) | 52 | const createActivityAudience = buildAudience([ byActor.followersUrl ], video.privacy === VideoPrivacy.PUBLIC) |