1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Split files in activitypub server

This commit is contained in:
Chocobozzz 2018-05-25 11:32:36 +02:00
parent 16f29007dc
commit e251f170b0
No known key found for this signature in database
GPG key ID: 583A612D890159BE
19 changed files with 133 additions and 136 deletions

View file

@ -7,17 +7,15 @@ import { VideoModel } from '../../../models/video/video'
import { VideoAbuseModel } from '../../../models/video/video-abuse'
import { VideoCommentModel } from '../../../models/video/video-comment'
import { getVideoAbuseActivityPubUrl, getVideoDislikeActivityPubUrl, getVideoViewActivityPubUrl } from '../url'
import { broadcastToActors, broadcastToFollowers, unicastTo } from './utils'
import {
audiencify,
broadcastToActors,
broadcastToFollowers,
getActorsInvolvedInVideo,
getAudience,
getObjectFollowersAudience,
getOriginVideoAudience,
getVideoCommentAudience,
unicastTo
} from './misc'
getVideoAudience,
getVideoCommentAudience
} from '../audience'
async function sendCreateVideo (video: VideoModel, t: Transaction) {
if (video.privacy === VideoPrivacy.PRIVATE) return undefined
@ -83,7 +81,7 @@ async function sendCreateView (byActor: ActorModel, video: VideoModel, t: Transa
// Send to origin
if (video.isOwned() === false) {
const audience = getOriginVideoAudience(video, actorsInvolvedInVideo)
const audience = getVideoAudience(video, actorsInvolvedInVideo)
const data = await createActivityData(url, byActor, viewActivityData, t, audience)
return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl)
@ -107,7 +105,7 @@ async function sendCreateDislike (byActor: ActorModel, video: VideoModel, t: Tra
// Send to origin
if (video.isOwned() === false) {
const audience = getOriginVideoAudience(video, actorsInvolvedInVideo)
const audience = getVideoAudience(video, actorsInvolvedInVideo)
const data = await createActivityData(url, byActor, dislikeActivityData, t, audience)
return unicastTo(data, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl)