diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-27 13:33:56 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-27 13:33:56 +0200 |
commit | 07197db4c567f22bbc9c12339062896dc76bac2f (patch) | |
tree | 5682f0d88fc1b4032018e5122ed42eb9967fd743 /server/lib/activitypub/send/send-like.ts | |
parent | da99ccf2681bcbc172a96cf30e7b733948767faa (diff) | |
download | PeerTube-07197db4c567f22bbc9c12339062896dc76bac2f.tar.gz PeerTube-07197db4c567f22bbc9c12339062896dc76bac2f.tar.zst PeerTube-07197db4c567f22bbc9c12339062896dc76bac2f.zip |
Try to refractor activities sending
There is still a need for work on this part though
Diffstat (limited to 'server/lib/activitypub/send/send-like.ts')
-rw-r--r-- | server/lib/activitypub/send/send-like.ts | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/server/lib/activitypub/send/send-like.ts b/server/lib/activitypub/send/send-like.ts index b01249e69..fb2b4aaf8 100644 --- a/server/lib/activitypub/send/send-like.ts +++ b/server/lib/activitypub/send/send-like.ts | |||
@@ -13,20 +13,20 @@ import { | |||
13 | unicastTo | 13 | unicastTo |
14 | } from './misc' | 14 | } from './misc' |
15 | 15 | ||
16 | async function sendLikeToOrigin (byActor: ActorModel, video: VideoModel, t: Transaction) { | 16 | async function sendLike (byActor: ActorModel, video: VideoModel, t: Transaction) { |
17 | const url = getVideoLikeActivityPubUrl(byActor, video) | 17 | const url = getVideoLikeActivityPubUrl(byActor, video) |
18 | 18 | ||
19 | const accountsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) | 19 | const accountsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) |
20 | const audience = getOriginVideoAudience(video, accountsInvolvedInVideo) | ||
21 | const data = await likeActivityData(url, byActor, video, t, audience) | ||
22 | 20 | ||
23 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) | 21 | // Send to origin |
24 | } | 22 | if (video.isOwned() === false) { |
23 | const audience = getOriginVideoAudience(video, accountsInvolvedInVideo) | ||
24 | const data = await likeActivityData(url, byActor, video, t, audience) | ||
25 | 25 | ||
26 | async function sendLikeToVideoFollowers (byActor: ActorModel, video: VideoModel, t: Transaction) { | 26 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) |
27 | const url = getVideoLikeActivityPubUrl(byActor, video) | 27 | } |
28 | 28 | ||
29 | const accountsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) | 29 | // Send to followers |
30 | const audience = getObjectFollowersAudience(accountsInvolvedInVideo) | 30 | const audience = getObjectFollowersAudience(accountsInvolvedInVideo) |
31 | const data = await likeActivityData(url, byActor, video, t, audience) | 31 | const data = await likeActivityData(url, byActor, video, t, audience) |
32 | 32 | ||
@@ -56,7 +56,6 @@ async function likeActivityData ( | |||
56 | // --------------------------------------------------------------------------- | 56 | // --------------------------------------------------------------------------- |
57 | 57 | ||
58 | export { | 58 | export { |
59 | sendLikeToOrigin, | 59 | sendLike, |
60 | sendLikeToVideoFollowers, | ||
61 | likeActivityData | 60 | likeActivityData |
62 | } | 61 | } |