X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Faudience.ts;h=2986714d309c4290b96d3bd11f6f9fd7040c6028;hb=92315d979c3f424d81f8fca3c8831d81e4e2a6d6;hp=f2ab54cf7fd1895c4a866c81b343512f11aeae17;hpb=001ed2d40c8d2c8f494f5dc7f91ed62d56df10fd;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/audience.ts b/server/lib/activitypub/audience.ts index f2ab54cf7..2986714d3 100644 --- a/server/lib/activitypub/audience.ts +++ b/server/lib/activitypub/audience.ts @@ -4,11 +4,11 @@ import { ACTIVITY_PUB } from '../../initializers/constants' import { ActorModel } from '../../models/activitypub/actor' import { VideoModel } from '../../models/video/video' import { VideoShareModel } from '../../models/video/video-share' -import { MActorFollowersUrl, MActorLight, MCommentOwner, MCommentOwnerVideo, MVideo, MVideoAccountLight } from '../../typings/models' +import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '../../types/models' -function getRemoteVideoAudience (video: MVideoAccountLight, actorsInvolvedInVideo: MActorFollowersUrl[]): ActivityAudience { +function getRemoteVideoAudience (accountActor: MActorUrl, actorsInvolvedInVideo: MActorFollowersUrl[]): ActivityAudience { return { - to: [ video.VideoChannel.Account.Actor.url ], + to: [ accountActor.url ], cc: actorsInvolvedInVideo.map(a => a.followersUrl) } } @@ -32,6 +32,8 @@ function getVideoCommentAudience ( // Send to actors we reply to for (const parentComment of threadParentComments) { + if (parentComment.isDeleted()) continue + cc.push(parentComment.Account.Actor.url) } @@ -48,12 +50,12 @@ function getAudienceFromFollowersOf (actorsInvolvedInObject: MActorFollowersUrl[ } } -async function getActorsInvolvedInVideo (video: MVideo, t: Transaction) { +async function getActorsInvolvedInVideo (video: MVideoId, t: Transaction) { const actors: MActorLight[] = await VideoShareModel.loadActorsByShare(video.id, t) const videoAll = video as VideoModel - const videoActor = videoAll.VideoChannel && videoAll.VideoChannel.Account + const videoActor = videoAll.VideoChannel?.Account ? videoAll.VideoChannel.Account.Actor : await ActorModel.loadFromAccountByVideoId(video.id, t)