aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/activitypub/process
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/activitypub/process')
-rw-r--r--server/lib/activitypub/process/process-create.ts10
-rw-r--r--server/lib/activitypub/process/process-update.ts10
2 files changed, 16 insertions, 4 deletions
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts
index 99841da14..559a0c23c 100644
--- a/server/lib/activitypub/process/process-create.ts
+++ b/server/lib/activitypub/process/process-create.ts
@@ -86,10 +86,14 @@ async function processCreateDislike (byActor: ActorModel, activity: ActivityCrea
86async function processCreateView (byActor: ActorModel, activity: ActivityCreate) { 86async function processCreateView (byActor: ActorModel, activity: ActivityCreate) {
87 const view = activity.object as ViewObject 87 const view = activity.object as ViewObject
88 88
89 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: view.object }) 89 const options = {
90 videoObject: view.object,
91 fetchType: 'only-video' as 'only-video'
92 }
93 const { video } = await getOrCreateVideoAndAccountAndChannel(options)
90 94
91 const actor = await ActorModel.loadByUrl(view.actor) 95 const actorExists = await ActorModel.isActorUrlExist(view.actor)
92 if (!actor) throw new Error('Unknown actor ' + view.actor) 96 if (actorExists === false) throw new Error('Unknown actor ' + view.actor)
93 97
94 await Redis.Instance.addVideoView(video.id) 98 await Redis.Instance.addVideoView(video.id)
95 99
diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts
index 935da5a54..0bceb370e 100644
--- a/server/lib/activitypub/process/process-update.ts
+++ b/server/lib/activitypub/process/process-update.ts
@@ -51,7 +51,15 @@ async function processUpdateVideo (actor: ActorModel, activity: ActivityUpdate)
51 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoObject.id }) 51 const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoObject.id })
52 const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject) 52 const channelActor = await getOrCreateVideoChannelFromVideoObject(videoObject)
53 53
54 return updateVideoFromAP(video, videoObject, actor.Account, channelActor.VideoChannel, activity.to) 54 const updateOptions = {
55 video,
56 videoObject,
57 account: actor.Account,
58 channel: channelActor.VideoChannel,
59 updateViews: true,
60 overrideTo: activity.to
61 }
62 return updateVideoFromAP(updateOptions)
55} 63}
56 64
57async function processUpdateCacheFile (byActor: ActorModel, activity: ActivityUpdate) { 65async function processUpdateCacheFile (byActor: ActorModel, activity: ActivityUpdate) {