X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Fprocess%2Fprocess-view.ts;h=c2d41dd2845fe2e629416795eb81863e07d3e91c;hb=304a84d59c3a800b7f7aef48cf55f307534c0926;hp=efceb21a207f64ecef6184f40dec2d8e8f807208;hpb=e4bf78561763cd84d22ebceb6f371cccf9a356d8;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/process/process-view.ts b/server/lib/activitypub/process/process-view.ts index efceb21a2..c2d41dd28 100644 --- a/server/lib/activitypub/process/process-view.ts +++ b/server/lib/activitypub/process/process-view.ts @@ -1,4 +1,4 @@ -import { getOrCreateVideoAndAccountAndChannel } from '../videos' +import { getOrCreateAPVideo } from '../videos' import { forwardVideoRelatedActivity } from '../send/utils' import { Redis } from '../../redis' import { ActivityCreate, ActivityView, ViewObject } from '../../../../shared/models/activitypub' @@ -29,7 +29,11 @@ async function processCreateView (activity: ActivityView | ActivityCreate, byAct fetchType: 'only-video' as 'only-video', allowRefresh: false as false } - const { video } = await getOrCreateVideoAndAccountAndChannel(options) + const { video } = await getOrCreateAPVideo(options) + + if (!video.isLive) { + await Redis.Instance.addVideoView(video.id) + } if (video.isOwned()) { // Our live manager will increment the counter and send the view to followers @@ -38,8 +42,6 @@ async function processCreateView (activity: ActivityView | ActivityCreate, byAct return } - await Redis.Instance.addVideoView(video.id) - // Forward the view but don't resend the activity to the sender const exceptions = [ byActor ] await forwardVideoRelatedActivity(activity, undefined, exceptions, video)