From 40ff57078e15d5b86ee6b71e198b95d3feb78eaf Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 22 Nov 2017 16:25:03 +0100 Subject: Federate video views --- server/lib/activitypub/send/misc.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'server/lib/activitypub/send/misc.ts') diff --git a/server/lib/activitypub/send/misc.ts b/server/lib/activitypub/send/misc.ts index bea955b67..f3dc5c148 100644 --- a/server/lib/activitypub/send/misc.ts +++ b/server/lib/activitypub/send/misc.ts @@ -4,16 +4,26 @@ import { ACTIVITY_PUB, database as db } from '../../../initializers' import { AccountInstance } from '../../../models/account/account-interface' import { activitypubHttpJobScheduler } from '../../jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler' -async function broadcastToFollowers (data: any, byAccount: AccountInstance, toAccountFollowers: AccountInstance[], t: Transaction) { +async function broadcastToFollowers ( + data: any, + byAccount: AccountInstance, + toAccountFollowers: AccountInstance[], + t: Transaction, + followersException: AccountInstance[] = [] +) { const toAccountFollowerIds = toAccountFollowers.map(a => a.id) + const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds) if (result.data.length === 0) { logger.info('Not broadcast because of 0 followers for %s.', toAccountFollowerIds.join(', ')) return undefined } + const followersSharedInboxException = followersException.map(f => f.sharedInboxUrl) + const uris = result.data.filter(sharedInbox => followersSharedInboxException.indexOf(sharedInbox) === -1) + const jobPayload = { - uris: result.data, + uris, signatureAccountId: byAccount.id, body: data } -- cgit v1.2.3