aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/send/send-create.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/send/send-create.ts')
-rw-r--r--server/lib/activitypub/send/send-create.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts
index 5d8763495..7c3a6bdd0 100644
--- a/server/lib/activitypub/send/send-create.ts
+++ b/server/lib/activitypub/send/send-create.ts
@@ -6,6 +6,7 @@ import { VideoCommentModel } from '../../../models/video/video-comment'
6import { 6import {
7 MActorLight, 7 MActorLight,
8 MCommentOwnerVideo, 8 MCommentOwnerVideo,
9 MLocalVideoViewerWithWatchSections,
9 MVideoAccountLight, 10 MVideoAccountLight,
10 MVideoAP, 11 MVideoAP,
11 MVideoPlaylistFull, 12 MVideoPlaylistFull,
@@ -19,6 +20,7 @@ import {
19 getActorsInvolvedInVideo, 20 getActorsInvolvedInVideo,
20 getAudienceFromFollowersOf, 21 getAudienceFromFollowersOf,
21 getVideoCommentAudience, 22 getVideoCommentAudience,
23 sendVideoActivityToOrigin,
22 sendVideoRelatedActivity, 24 sendVideoRelatedActivity,
23 unicastTo 25 unicastTo
24} from './shared' 26} from './shared'
@@ -61,6 +63,18 @@ async function sendCreateCacheFile (
61 }) 63 })
62} 64}
63 65
66async function sendCreateWatchAction (stats: MLocalVideoViewerWithWatchSections, transaction: Transaction) {
67 logger.info('Creating job to send create watch action %s.', stats.url, lTags(stats.uuid))
68
69 const byActor = await getServerActor()
70
71 const activityBuilder = (audience: ActivityAudience) => {
72 return buildCreateActivity(stats.url, byActor, stats.toActivityPubObject(), audience)
73 }
74
75 return sendVideoActivityToOrigin(activityBuilder, { byActor, video: stats.Video, transaction, contextType: 'WatchAction' })
76}
77
64async function sendCreateVideoPlaylist (playlist: MVideoPlaylistFull, transaction: Transaction) { 78async function sendCreateVideoPlaylist (playlist: MVideoPlaylistFull, transaction: Transaction) {
65 if (playlist.privacy === VideoPlaylistPrivacy.PRIVATE) return undefined 79 if (playlist.privacy === VideoPlaylistPrivacy.PRIVATE) return undefined
66 80
@@ -175,7 +189,8 @@ export {
175 buildCreateActivity, 189 buildCreateActivity,
176 sendCreateVideoComment, 190 sendCreateVideoComment,
177 sendCreateVideoPlaylist, 191 sendCreateVideoPlaylist,
178 sendCreateCacheFile 192 sendCreateCacheFile,
193 sendCreateWatchAction
179} 194}
180 195
181// --------------------------------------------------------------------------- 196// ---------------------------------------------------------------------------