aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/send/misc.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-22 16:25:03 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commit40ff57078e15d5b86ee6b71e198b95d3feb78eaf (patch)
tree88031d4eac6a26597e8a1f2fc63674664e3eae26 /server/lib/activitypub/send/misc.ts
parentc46edbc2f6ca310b2f0331f979ac6caf27f6eb92 (diff)
downloadPeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.tar.gz
PeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.tar.zst
PeerTube-40ff57078e15d5b86ee6b71e198b95d3feb78eaf.zip
Federate video views
Diffstat (limited to 'server/lib/activitypub/send/misc.ts')
-rw-r--r--server/lib/activitypub/send/misc.ts14
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'
4import { AccountInstance } from '../../../models/account/account-interface' 4import { AccountInstance } from '../../../models/account/account-interface'
5import { activitypubHttpJobScheduler } from '../../jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler' 5import { activitypubHttpJobScheduler } from '../../jobs/activitypub-http-job-scheduler/activitypub-http-job-scheduler'
6 6
7async function broadcastToFollowers (data: any, byAccount: AccountInstance, toAccountFollowers: AccountInstance[], t: Transaction) { 7async 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 }