diff options
Diffstat (limited to 'server/lib/activitypub/send/misc.ts')
-rw-r--r-- | server/lib/activitypub/send/misc.ts | 14 |
1 files changed, 12 insertions, 2 deletions
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' | |||
4 | import { AccountInstance } from '../../../models/account/account-interface' | 4 | import { AccountInstance } from '../../../models/account/account-interface' |
5 | import { activitypubHttpJobScheduler } from '../../jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler' | 5 | import { activitypubHttpJobScheduler } from '../../jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler' |
6 | 6 | ||
7 | async function broadcastToFollowers (data: any, byAccount: AccountInstance, toAccountFollowers: AccountInstance[], t: Transaction) { | 7 | async function broadcastToFollowers ( |
8 | data: any, | ||
9 | byAccount: AccountInstance, | ||
10 | toAccountFollowers: AccountInstance[], | ||
11 | t: Transaction, | ||
12 | followersException: AccountInstance[] = [] | ||
13 | ) { | ||
8 | const toAccountFollowerIds = toAccountFollowers.map(a => a.id) | 14 | const toAccountFollowerIds = toAccountFollowers.map(a => a.id) |
15 | |||
9 | const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds) | 16 | const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds) |
10 | if (result.data.length === 0) { | 17 | if (result.data.length === 0) { |
11 | logger.info('Not broadcast because of 0 followers for %s.', toAccountFollowerIds.join(', ')) | 18 | logger.info('Not broadcast because of 0 followers for %s.', toAccountFollowerIds.join(', ')) |
12 | return undefined | 19 | return undefined |
13 | } | 20 | } |
14 | 21 | ||
22 | const followersSharedInboxException = followersException.map(f => f.sharedInboxUrl) | ||
23 | const uris = result.data.filter(sharedInbox => followersSharedInboxException.indexOf(sharedInbox) === -1) | ||
24 | |||
15 | const jobPayload = { | 25 | const jobPayload = { |
16 | uris: result.data, | 26 | uris, |
17 | signatureAccountId: byAccount.id, | 27 | signatureAccountId: byAccount.id, |
18 | body: data | 28 | body: data |
19 | } | 29 | } |