diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-26 12:02:18 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-26 13:43:34 +0100 |
commit | 7acee6f18aac99e359360fc4f2362d5405135a79 (patch) | |
tree | a8eceaba9a01b913fcfca32f17f26b4f588a633e /server/lib/activitypub/send | |
parent | d6e99e5322209a692cc3d870ddb5dcedbda69f2a (diff) | |
download | PeerTube-7acee6f18aac99e359360fc4f2362d5405135a79.tar.gz PeerTube-7acee6f18aac99e359360fc4f2362d5405135a79.tar.zst PeerTube-7acee6f18aac99e359360fc4f2362d5405135a79.zip |
Fix announce activities
Diffstat (limited to 'server/lib/activitypub/send')
-rw-r--r-- | server/lib/activitypub/send/send-announce.ts | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/server/lib/activitypub/send/send-announce.ts b/server/lib/activitypub/send/send-announce.ts index 93b5668d2..76cb3f80c 100644 --- a/server/lib/activitypub/send/send-announce.ts +++ b/server/lib/activitypub/send/send-announce.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { Transaction } from 'sequelize' | 1 | import { Transaction } from 'sequelize' |
2 | import { ActivityAnnounce, ActivityAudience, ActivityCreate } from '../../../../shared/models/activitypub' | 2 | import { ActivityAnnounce, ActivityAudience } from '../../../../shared/models/activitypub' |
3 | import { VideoPrivacy } from '../../../../shared/models/videos' | ||
4 | import { ActorModel } from '../../../models/activitypub/actor' | 3 | import { ActorModel } from '../../../models/activitypub/actor' |
5 | import { VideoModel } from '../../../models/video/video' | 4 | import { VideoModel } from '../../../models/video/video' |
6 | import { getAnnounceActivityPubUrl } from '../url' | 5 | import { getAnnounceActivityPubUrl } from '../url' |
@@ -16,14 +15,11 @@ import { createActivityData } from './send-create' | |||
16 | 15 | ||
17 | async function buildVideoAnnounceToFollowers (byActor: ActorModel, video: VideoModel, t: Transaction) { | 16 | async function buildVideoAnnounceToFollowers (byActor: ActorModel, video: VideoModel, t: Transaction) { |
18 | const url = getAnnounceActivityPubUrl(video.url, byActor) | 17 | const url = getAnnounceActivityPubUrl(video.url, byActor) |
19 | const videoObject = video.toActivityPubObject() | 18 | const announcedObject = video.url |
20 | |||
21 | const announcedAudience = await getAudience(byActor, t, video.privacy === VideoPrivacy.PUBLIC) | ||
22 | const announcedActivity = await createActivityData(url, video.VideoChannel.Account.Actor, videoObject, t, announcedAudience) | ||
23 | 19 | ||
24 | const accountsToForwardView = await getActorsInvolvedInVideo(video, t) | 20 | const accountsToForwardView = await getActorsInvolvedInVideo(video, t) |
25 | const audience = getObjectFollowersAudience(accountsToForwardView) | 21 | const audience = getObjectFollowersAudience(accountsToForwardView) |
26 | return announceActivityData(url, byActor, announcedActivity, t, audience) | 22 | return announceActivityData(url, byActor, announcedObject, t, audience) |
27 | } | 23 | } |
28 | 24 | ||
29 | async function sendVideoAnnounceToFollowers (byActor: ActorModel, video: VideoModel, t: Transaction) { | 25 | async function sendVideoAnnounceToFollowers (byActor: ActorModel, video: VideoModel, t: Transaction) { |
@@ -48,7 +44,7 @@ async function sendVideoAnnounceToOrigin (byActor: ActorModel, video: VideoModel | |||
48 | async function announceActivityData ( | 44 | async function announceActivityData ( |
49 | url: string, | 45 | url: string, |
50 | byActor: ActorModel, | 46 | byActor: ActorModel, |
51 | object: ActivityCreate, | 47 | object: string, |
52 | t: Transaction, | 48 | t: Transaction, |
53 | audience?: ActivityAudience | 49 | audience?: ActivityAudience |
54 | ): Promise<ActivityAnnounce> { | 50 | ): Promise<ActivityAnnounce> { |