aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/send/send-create.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-05 11:19:25 +0100
committerChocobozzz <me@florianbigard.com>2018-01-05 11:19:25 +0100
commitd7e70384a360cda51fe23712331110a5c8b1124c (patch)
tree385609669c92936a5c66ae028c331fb4a9b5943e /server/lib/activitypub/send/send-create.ts
parent2890b615f31ab7d519d8be66b49ff8712df90c51 (diff)
downloadPeerTube-d7e70384a360cda51fe23712331110a5c8b1124c.tar.gz
PeerTube-d7e70384a360cda51fe23712331110a5c8b1124c.tar.zst
PeerTube-d7e70384a360cda51fe23712331110a5c8b1124c.zip
Add mentions to comments
Diffstat (limited to 'server/lib/activitypub/send/send-create.ts')
-rw-r--r--server/lib/activitypub/send/send-create.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts
index 2f5cdc8c5..e2ee639d9 100644
--- a/server/lib/activitypub/send/send-create.ts
+++ b/server/lib/activitypub/send/send-create.ts
@@ -8,7 +8,8 @@ import { VideoAbuseModel } from '../../../models/video/video-abuse'
8import { VideoCommentModel } from '../../../models/video/video-comment' 8import { VideoCommentModel } from '../../../models/video/video-comment'
9import { getVideoAbuseActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoViewActivityPubUrl } from '../url' 9import { getVideoAbuseActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoViewActivityPubUrl } from '../url'
10import { 10import {
11 audiencify, broadcastToFollowers, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, getOriginVideoAudience, 11 audiencify, broadcastToFollowers, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience,
12 getOriginVideoAudience, getOriginVideoCommentAudience,
12 unicastTo 13 unicastTo
13} from './misc' 14} from './misc'
14 15
@@ -35,11 +36,12 @@ async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel,
35 36
36async function sendCreateVideoCommentToOrigin (comment: VideoCommentModel, t: Transaction) { 37async function sendCreateVideoCommentToOrigin (comment: VideoCommentModel, t: Transaction) {
37 const byActor = comment.Account.Actor 38 const byActor = comment.Account.Actor
39 const threadParentComments = await VideoCommentModel.listThreadParentComments(comment, t)
40 const commentObject = comment.toActivityPubObject(threadParentComments)
38 41
39 const actorsInvolvedInVideo = await getActorsInvolvedInVideo(comment.Video, t) 42 const actorsInvolvedInVideo = await getActorsInvolvedInVideo(comment.Video, t)
40 const audience = getOriginVideoAudience(comment.Video, actorsInvolvedInVideo) 43 const audience = getOriginVideoCommentAudience(comment, threadParentComments, actorsInvolvedInVideo)
41 44
42 const commentObject = comment.toActivityPubObject()
43 const data = await createActivityData(comment.url, byActor, commentObject, t, audience) 45 const data = await createActivityData(comment.url, byActor, commentObject, t, audience)
44 46
45 return unicastTo(data, byActor, comment.Video.VideoChannel.Account.Actor.sharedInboxUrl, t) 47 return unicastTo(data, byActor, comment.Video.VideoChannel.Account.Actor.sharedInboxUrl, t)
@@ -47,15 +49,15 @@ async function sendCreateVideoCommentToOrigin (comment: VideoCommentModel, t: Tr
47 49
48async function sendCreateVideoCommentToVideoFollowers (comment: VideoCommentModel, t: Transaction) { 50async function sendCreateVideoCommentToVideoFollowers (comment: VideoCommentModel, t: Transaction) {
49 const byActor = comment.Account.Actor 51 const byActor = comment.Account.Actor
52 const threadParentComments = await VideoCommentModel.listThreadParentComments(comment, t)
53 const commentObject = comment.toActivityPubObject(threadParentComments)
50 54
51 const actorsToForwardView = await getActorsInvolvedInVideo(comment.Video, t) 55 const actorsInvolvedInVideo = await getActorsInvolvedInVideo(comment.Video, t)
52 const audience = getObjectFollowersAudience(actorsToForwardView) 56 const audience = getOriginVideoCommentAudience(comment, threadParentComments, actorsInvolvedInVideo)
53
54 const commentObject = comment.toActivityPubObject()
55 const data = await createActivityData(comment.url, byActor, commentObject, t, audience) 57 const data = await createActivityData(comment.url, byActor, commentObject, t, audience)
56 58
57 const followersException = [ byActor ] 59 const followersException = [ byActor ]
58 return broadcastToFollowers(data, byActor, actorsToForwardView, t, followersException) 60 return broadcastToFollowers(data, byActor, actorsInvolvedInVideo, t, followersException)
59} 61}
60 62
61async function sendCreateViewToOrigin (byActor: ActorModel, video: VideoModel, t: Transaction) { 63async function sendCreateViewToOrigin (byActor: ActorModel, video: VideoModel, t: Transaction) {