diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-12 20:04:58 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-12 20:37:51 +0200 |
commit | 2186386cca113506791583cb07d6ccacba7af4e0 (patch) | |
tree | 3c214c0b5fbd64332624267fa6e51fd4a9cf6474 /server/lib/activitypub/send/send-undo.ts | |
parent | 6ccdf3a23ecec5ba2eeaf487fd1fafdc7606b4bf (diff) | |
download | PeerTube-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-undo.ts')
-rw-r--r-- | server/lib/activitypub/send/send-undo.ts | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts index 9733e66dc..33c3d2429 100644 --- a/server/lib/activitypub/send/send-undo.ts +++ b/server/lib/activitypub/send/send-undo.ts | |||
@@ -27,7 +27,7 @@ async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) { | |||
27 | const undoUrl = getUndoActivityPubUrl(followUrl) | 27 | const undoUrl = getUndoActivityPubUrl(followUrl) |
28 | 28 | ||
29 | const object = followActivityData(followUrl, me, following) | 29 | const object = followActivityData(followUrl, me, following) |
30 | const data = await undoActivityData(undoUrl, me, object, t) | 30 | const data = undoActivityData(undoUrl, me, object) |
31 | 31 | ||
32 | return unicastTo(data, me, following.inboxUrl) | 32 | return unicastTo(data, me, following.inboxUrl) |
33 | } | 33 | } |
@@ -37,18 +37,18 @@ async function sendUndoLike (byActor: ActorModel, video: VideoModel, t: Transact | |||
37 | const undoUrl = getUndoActivityPubUrl(likeUrl) | 37 | const undoUrl = getUndoActivityPubUrl(likeUrl) |
38 | 38 | ||
39 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) | 39 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) |
40 | const object = await likeActivityData(likeUrl, byActor, video, t) | 40 | const object = likeActivityData(likeUrl, byActor, video) |
41 | 41 | ||
42 | // Send to origin | 42 | // Send to origin |
43 | if (video.isOwned() === false) { | 43 | if (video.isOwned() === false) { |
44 | const audience = getVideoAudience(video, actorsInvolvedInVideo) | 44 | const audience = getVideoAudience(video, actorsInvolvedInVideo) |
45 | const data = await undoActivityData(undoUrl, byActor, object, t, audience) | 45 | const data = undoActivityData(undoUrl, byActor, object, audience) |
46 | 46 | ||
47 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) | 47 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) |
48 | } | 48 | } |
49 | 49 | ||
50 | const audience = getObjectFollowersAudience(actorsInvolvedInVideo) | 50 | const audience = getObjectFollowersAudience(actorsInvolvedInVideo) |
51 | const data = await undoActivityData(undoUrl, byActor, object, t, audience) | 51 | const data = undoActivityData(undoUrl, byActor, object, audience) |
52 | 52 | ||
53 | const followersException = [ byActor ] | 53 | const followersException = [ byActor ] |
54 | return broadcastToFollowers(data, byActor, actorsInvolvedInVideo, t, followersException) | 54 | return broadcastToFollowers(data, byActor, actorsInvolvedInVideo, t, followersException) |
@@ -60,16 +60,16 @@ async function sendUndoDislike (byActor: ActorModel, video: VideoModel, t: Trans | |||
60 | 60 | ||
61 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) | 61 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) |
62 | const dislikeActivity = createDislikeActivityData(byActor, video) | 62 | const dislikeActivity = createDislikeActivityData(byActor, video) |
63 | const object = await createActivityData(dislikeUrl, byActor, dislikeActivity, t) | 63 | const object = createActivityData(dislikeUrl, byActor, dislikeActivity) |
64 | 64 | ||
65 | if (video.isOwned() === false) { | 65 | if (video.isOwned() === false) { |
66 | const audience = getVideoAudience(video, actorsInvolvedInVideo) | 66 | const audience = getVideoAudience(video, actorsInvolvedInVideo) |
67 | const data = await undoActivityData(undoUrl, byActor, object, t, audience) | 67 | const data = undoActivityData(undoUrl, byActor, object, audience) |
68 | 68 | ||
69 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) | 69 | return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) |
70 | } | 70 | } |
71 | 71 | ||
72 | const data = await undoActivityData(undoUrl, byActor, object, t) | 72 | const data = undoActivityData(undoUrl, byActor, object) |
73 | 73 | ||
74 | const followersException = [ byActor ] | 74 | const followersException = [ byActor ] |
75 | return broadcastToFollowers(data, byActor, actorsInvolvedInVideo, t, followersException) | 75 | return broadcastToFollowers(data, byActor, actorsInvolvedInVideo, t, followersException) |
@@ -80,7 +80,7 @@ async function sendUndoAnnounce (byActor: ActorModel, videoShare: VideoShareMode | |||
80 | 80 | ||
81 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) | 81 | const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) |
82 | const object = await buildVideoAnnounce(byActor, videoShare, video, t) | 82 | const object = await buildVideoAnnounce(byActor, videoShare, video, t) |
83 | const data = await undoActivityData(undoUrl, byActor, object, t) | 83 | const data = undoActivityData(undoUrl, byActor, object) |
84 | 84 | ||
85 | const followersException = [ byActor ] | 85 | const followersException = [ byActor ] |
86 | return broadcastToFollowers(data, byActor, actorsInvolvedInVideo, t, followersException) | 86 | return broadcastToFollowers(data, byActor, actorsInvolvedInVideo, t, followersException) |
@@ -97,21 +97,21 @@ export { | |||
97 | 97 | ||
98 | // --------------------------------------------------------------------------- | 98 | // --------------------------------------------------------------------------- |
99 | 99 | ||
100 | async function undoActivityData ( | 100 | function undoActivityData ( |
101 | url: string, | 101 | url: string, |
102 | byActor: ActorModel, | 102 | byActor: ActorModel, |
103 | object: ActivityFollow | ActivityLike | ActivityCreate | ActivityAnnounce, | 103 | object: ActivityFollow | ActivityLike | ActivityCreate | ActivityAnnounce, |
104 | t: Transaction, | ||
105 | audience?: ActivityAudience | 104 | audience?: ActivityAudience |
106 | ): Promise<ActivityUndo> { | 105 | ): ActivityUndo { |
107 | if (!audience) { | 106 | if (!audience) audience = getAudience(byActor) |
108 | audience = await getAudience(byActor, t) | 107 | |
109 | } | 108 | return audiencify( |
110 | 109 | { | |
111 | return audiencify({ | 110 | type: 'Undo' as 'Undo', |
112 | type: 'Undo' as 'Undo', | 111 | id: url, |
113 | id: url, | 112 | actor: byActor.url, |
114 | actor: byActor.url, | 113 | object |
115 | object | 114 | }, |
116 | }, audience) | 115 | audience |
116 | ) | ||
117 | } | 117 | } |