From 030177d246834fdba89be9bbaeac497589b47102 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Nov 2018 16:18:12 +0100 Subject: Don't forward view, send updates instead To avoid inconsistencies in the federation, now the origin server will tell other instances what is the correct number of views --- server/lib/activitypub/process/process-create.ts | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index 920d02cd2..214e14546 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts @@ -13,7 +13,8 @@ import { forwardVideoRelatedActivity } from '../send/utils' import { Redis } from '../../redis' import { createOrUpdateCacheFile } from '../cache-file' import { immutableAssign } from '../../../tests/utils' -import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' +import { getVideoDislikeActivityPubUrl } from '../url' +import { VideoModel } from '../../../models/video/video' async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) { const activityObject = activity.object @@ -87,19 +88,10 @@ async function processCreateDislike (byActor: ActorModel, activity: ActivityCrea async function processCreateView (byActor: ActorModel, activity: ActivityCreate) { const view = activity.object as ViewObject - const options = { - videoObject: view.object, - fetchType: 'only-video' as 'only-video' - } - const { video } = await getOrCreateVideoAndAccountAndChannel(options) + const video = await VideoModel.loadByUrl(view.object) + if (!video || video.isOwned() === false) return await Redis.Instance.addVideoView(video.id) - - if (video.isOwned()) { - // Don't resend the activity to the sender - const exceptions = [ byActor ] - await forwardVideoRelatedActivity(activity, undefined, exceptions, video) - } } async function processCacheFile (byActor: ActorModel, activity: ActivityCreate) { -- cgit v1.2.3