From: Chocobozzz Date: Mon, 11 Feb 2019 10:00:09 +0000 (+0100) Subject: Merge branch 'feature/correctly-send-activities' into develop X-Git-Tag: v1.3.0-rc.1~205^2~2^2~2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=28f3d1b36a70426795240c9370e47b6c4ba847f8;p=oweals%2Fpeertube.git Merge branch 'feature/correctly-send-activities' into develop --- 28f3d1b36a70426795240c9370e47b6c4ba847f8 diff --cc server/controllers/activitypub/client.ts index 32a83aa5f,7e87f6f3b..31c0a5fbd --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts @@@ -37,9 -33,10 +33,10 @@@ import getVideoSharesActivityPubUrl } from '../../lib/activitypub' import { VideoCaptionModel } from '../../models/video/video-caption' -import { videoRedundancyGetValidator } from '../../middlewares/validators/redundancy' +import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator } from '../../middlewares/validators/redundancy' import { getServerActor } from '../../helpers/utils' import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' + import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike' const activityPubClientRouter = express.Router() diff --cc server/lib/activitypub/send/send-create.ts index 605aaba06,73e667ad4..ef20e404c --- a/server/lib/activitypub/send/send-create.ts +++ b/server/lib/activitypub/send/send-create.ts @@@ -25,23 -23,12 +23,9 @@@ async function sendCreateVideo (video: return broadcastToFollowers(createActivity, byActor, [ byActor ], t) } - async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, video: VideoModel) { - if (!video.VideoChannel.Account.Actor.serverId) return // Local - - const url = getVideoAbuseActivityPubUrl(videoAbuse) - - logger.info('Creating job to send video abuse %s.', url) - - // Custom audience, we only send the abuse to the origin instance - const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] } - const createActivity = buildCreateActivity(url, byActor, videoAbuse.toActivityPubObject(), audience) - - return unicastTo(createActivity, byActor, video.VideoChannel.Account.Actor.sharedInboxUrl) - } - -async function sendCreateCacheFile (byActor: ActorModel, fileRedundancy: VideoRedundancyModel) { +async function sendCreateCacheFile (byActor: ActorModel, video: VideoModel, fileRedundancy: VideoRedundancyModel) { logger.info('Creating job to send file cache of %s.', fileRedundancy.url) - const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(fileRedundancy.VideoFile.Video.id) - const redundancyObject = fileRedundancy.toActivityPubObject() - return sendVideoRelatedCreateActivity({ byActor, video,