aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/send/send-like.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-12 20:04:58 +0200
committerChocobozzz <me@florianbigard.com>2018-06-12 20:37:51 +0200
commit2186386cca113506791583cb07d6ccacba7af4e0 (patch)
tree3c214c0b5fbd64332624267fa6e51fd4a9cf6474 /server/lib/activitypub/send/send-like.ts
parent6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf (diff)
downloadPeerTube-2186386cca113506791583cb07d6ccacba7af4e0.tar.gz
PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.tar.zst
PeerTube-2186386cca113506791583cb07d6ccacba7af4e0.zip
Add concept of video state, and add ability to wait transcoding before
publishing a video
Diffstat (limited to 'server/lib/activitypub/send/send-like.ts')
-rw-r--r--server/lib/activitypub/send/send-like.ts33
1 files changed, 14 insertions, 19 deletions
diff --git a/server/lib/activitypub/send/send-like.ts b/server/lib/activitypub/send/send-like.ts
index ddeb1fcd2..37ee7c096 100644
--- a/server/lib/activitypub/send/send-like.ts
+++ b/server/lib/activitypub/send/send-like.ts
@@ -14,36 +14,31 @@ async function sendLike (byActor: ActorModel, video: VideoModel, t: Transaction)
14 // Send to origin 14 // Send to origin
15 if (video.isOwned() === false) { 15 if (video.isOwned() === false) {
16 const audience = getVideoAudience(video, accountsInvolvedInVideo) 16 const audience = getVideoAudience(video, accountsInvolvedInVideo)
17 const data = await likeActivityData(url, byActor, video, t, audience) 17 const data = likeActivityData(url, byActor, video, audience)
18 18
19 return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) 19 return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl)
20 } 20 }
21 21
22 // Send to followers 22 // Send to followers
23 const audience = getObjectFollowersAudience(accountsInvolvedInVideo) 23 const audience = getObjectFollowersAudience(accountsInvolvedInVideo)
24 const data = await likeActivityData(url, byActor, video, t, audience) 24 const data = likeActivityData(url, byActor, video, audience)
25 25
26 const followersException = [ byActor ] 26 const followersException = [ byActor ]
27 return broadcastToFollowers(data, byActor, accountsInvolvedInVideo, t, followersException) 27 return broadcastToFollowers(data, byActor, accountsInvolvedInVideo, t, followersException)
28} 28}
29 29
30async function likeActivityData ( 30function likeActivityData (url: string, byActor: ActorModel, video: VideoModel, audience?: ActivityAudience): ActivityLike {
31 url: string, 31 if (!audience) audience = getAudience(byActor)
32 byActor: ActorModel, 32
33 video: VideoModel, 33 return audiencify(
34 t: Transaction, 34 {
35 audience?: ActivityAudience 35 type: 'Like' as 'Like',
36): Promise<ActivityLike> { 36 id: url,
37 if (!audience) { 37 actor: byActor.url,
38 audience = await getAudience(byActor, t) 38 object: video.url
39 } 39 },
40 40 audience
41 return audiencify({ 41 )
42 type: 'Like' as 'Like',
43 id: url,
44 actor: byActor.url,
45 object: video.url
46 }, audience)
47} 42}
48 43
49// --------------------------------------------------------------------------- 44// ---------------------------------------------------------------------------