aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/send
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-03-05 10:58:44 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-03-18 11:17:59 +0100
commitdf0b219d36bf6852cdf2a7ad09ed4a41c6bccefa (patch)
treec4984e854f5dc18e5c27afd73b843bd52c143034 /server/lib/activitypub/send
parent07b1a18aa678d260009a93e36606c5c5f585723d (diff)
downloadPeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.tar.gz
PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.tar.zst
PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.zip
Add playlist rest tests
Diffstat (limited to 'server/lib/activitypub/send')
-rw-r--r--server/lib/activitypub/send/send-create.ts2
-rw-r--r--server/lib/activitypub/send/send-delete.ts7
-rw-r--r--server/lib/activitypub/send/send-update.ts4
3 files changed, 9 insertions, 4 deletions
diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts
index bacdb97e3..28f18595b 100644
--- a/server/lib/activitypub/send/send-create.ts
+++ b/server/lib/activitypub/send/send-create.ts
@@ -45,7 +45,7 @@ async function sendCreateVideoPlaylist (playlist: VideoPlaylistModel, t: Transac
45 const byActor = playlist.OwnerAccount.Actor 45 const byActor = playlist.OwnerAccount.Actor
46 const audience = getAudience(byActor, playlist.privacy === VideoPlaylistPrivacy.PUBLIC) 46 const audience = getAudience(byActor, playlist.privacy === VideoPlaylistPrivacy.PUBLIC)
47 47
48 const object = await playlist.toActivityPubObject() 48 const object = await playlist.toActivityPubObject(null, t)
49 const createActivity = buildCreateActivity(playlist.url, byActor, object, audience) 49 const createActivity = buildCreateActivity(playlist.url, byActor, object, audience)
50 50
51 const serverActor = await getServerActor() 51 const serverActor = await getServerActor()
diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts
index 016811e60..7bf5ca520 100644
--- a/server/lib/activitypub/send/send-delete.ts
+++ b/server/lib/activitypub/send/send-delete.ts
@@ -31,7 +31,12 @@ async function sendDeleteActor (byActor: ActorModel, t: Transaction) {
31 const url = getDeleteActivityPubUrl(byActor.url) 31 const url = getDeleteActivityPubUrl(byActor.url)
32 const activity = buildDeleteActivity(url, byActor.url, byActor) 32 const activity = buildDeleteActivity(url, byActor.url, byActor)
33 33
34 const actorsInvolved = await VideoShareModel.loadActorsByVideoOwner(byActor.id, t) 34 const actorsInvolved = await VideoShareModel.loadActorsWhoSharedVideosOf(byActor.id, t)
35
36 // In case the actor did not have any videos
37 const serverActor = await getServerActor()
38 actorsInvolved.push(serverActor)
39
35 actorsInvolved.push(byActor) 40 actorsInvolved.push(byActor)
36 41
37 return broadcastToFollowers(activity, byActor, actorsInvolved, t) 42 return broadcastToFollowers(activity, byActor, actorsInvolved, t)
diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts
index 3eb2704fd..7411c08d5 100644
--- a/server/lib/activitypub/send/send-update.ts
+++ b/server/lib/activitypub/send/send-update.ts
@@ -52,7 +52,7 @@ async function sendUpdateActor (accountOrChannel: AccountModel | VideoChannelMod
52 let actorsInvolved: ActorModel[] 52 let actorsInvolved: ActorModel[]
53 if (accountOrChannel instanceof AccountModel) { 53 if (accountOrChannel instanceof AccountModel) {
54 // Actors that shared my videos are involved too 54 // Actors that shared my videos are involved too
55 actorsInvolved = await VideoShareModel.loadActorsByVideoOwner(byActor.id, t) 55 actorsInvolved = await VideoShareModel.loadActorsWhoSharedVideosOf(byActor.id, t)
56 } else { 56 } else {
57 // Actors that shared videos of my channel are involved too 57 // Actors that shared videos of my channel are involved too
58 actorsInvolved = await VideoShareModel.loadActorsByVideoChannel(accountOrChannel.id, t) 58 actorsInvolved = await VideoShareModel.loadActorsByVideoChannel(accountOrChannel.id, t)
@@ -87,7 +87,7 @@ async function sendUpdateVideoPlaylist (videoPlaylist: VideoPlaylistModel, t: Tr
87 87
88 const url = getUpdateActivityPubUrl(videoPlaylist.url, videoPlaylist.updatedAt.toISOString()) 88 const url = getUpdateActivityPubUrl(videoPlaylist.url, videoPlaylist.updatedAt.toISOString())
89 89
90 const object = await videoPlaylist.toActivityPubObject() 90 const object = await videoPlaylist.toActivityPubObject(null, t)
91 const audience = getAudience(byActor, videoPlaylist.privacy === VideoPlaylistPrivacy.PUBLIC) 91 const audience = getAudience(byActor, videoPlaylist.privacy === VideoPlaylistPrivacy.PUBLIC)
92 92
93 const updateActivity = buildUpdateActivity(url, byActor, object, audience) 93 const updateActivity = buildUpdateActivity(url, byActor, object, audience)