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-update.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-update.ts')
-rw-r--r-- | server/lib/activitypub/send/send-update.ts | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts index d64b88343..2fd374ec6 100644 --- a/server/lib/activitypub/send/send-update.ts +++ b/server/lib/activitypub/send/send-update.ts | |||
@@ -15,9 +15,9 @@ async function sendUpdateVideo (video: VideoModel, t: Transaction) { | |||
15 | 15 | ||
16 | const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString()) | 16 | const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString()) |
17 | const videoObject = video.toActivityPubObject() | 17 | const videoObject = video.toActivityPubObject() |
18 | const audience = await getAudience(byActor, t, video.privacy === VideoPrivacy.PUBLIC) | 18 | const audience = getAudience(byActor, video.privacy === VideoPrivacy.PUBLIC) |
19 | 19 | ||
20 | const data = await updateActivityData(url, byActor, videoObject, t, audience) | 20 | const data = updateActivityData(url, byActor, videoObject, audience) |
21 | 21 | ||
22 | const actorsInvolved = await VideoShareModel.loadActorsByShare(video.id, t) | 22 | const actorsInvolved = await VideoShareModel.loadActorsByShare(video.id, t) |
23 | actorsInvolved.push(byActor) | 23 | actorsInvolved.push(byActor) |
@@ -30,8 +30,8 @@ async function sendUpdateActor (accountOrChannel: AccountModel | VideoChannelMod | |||
30 | 30 | ||
31 | const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString()) | 31 | const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString()) |
32 | const accountOrChannelObject = accountOrChannel.toActivityPubObject() | 32 | const accountOrChannelObject = accountOrChannel.toActivityPubObject() |
33 | const audience = await getAudience(byActor, t) | 33 | const audience = getAudience(byActor) |
34 | const data = await updateActivityData(url, byActor, accountOrChannelObject, t, audience) | 34 | const data = updateActivityData(url, byActor, accountOrChannelObject, audience) |
35 | 35 | ||
36 | let actorsInvolved: ActorModel[] | 36 | let actorsInvolved: ActorModel[] |
37 | if (accountOrChannel instanceof AccountModel) { | 37 | if (accountOrChannel instanceof AccountModel) { |
@@ -56,21 +56,17 @@ export { | |||
56 | 56 | ||
57 | // --------------------------------------------------------------------------- | 57 | // --------------------------------------------------------------------------- |
58 | 58 | ||
59 | async function updateActivityData ( | 59 | function updateActivityData (url: string, byActor: ActorModel, object: any, audience?: ActivityAudience): ActivityUpdate { |
60 | url: string, | 60 | if (!audience) audience = getAudience(byActor) |
61 | byActor: ActorModel, | ||
62 | object: any, | ||
63 | t: Transaction, | ||
64 | audience?: ActivityAudience | ||
65 | ): Promise<ActivityUpdate> { | ||
66 | if (!audience) { | ||
67 | audience = await getAudience(byActor, t) | ||
68 | } | ||
69 | 61 | ||
70 | return audiencify({ | 62 | return audiencify( |
71 | type: 'Update' as 'Update', | 63 | { |
72 | id: url, | 64 | type: 'Update' as 'Update', |
73 | actor: byActor.url, | 65 | id: url, |
74 | object: audiencify(object, audience) | 66 | actor: byActor.url, |
75 | }, audience) | 67 | object: audiencify(object, audience |
68 | ) | ||
69 | }, | ||
70 | audience | ||
71 | ) | ||
76 | } | 72 | } |