diff options
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/process/process-create.ts | 16 |
1 files changed, 4 insertions, 12 deletions
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' | |||
13 | import { Redis } from '../../redis' | 13 | import { Redis } from '../../redis' |
14 | import { createOrUpdateCacheFile } from '../cache-file' | 14 | import { createOrUpdateCacheFile } from '../cache-file' |
15 | import { immutableAssign } from '../../../tests/utils' | 15 | import { immutableAssign } from '../../../tests/utils' |
16 | import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' | 16 | import { getVideoDislikeActivityPubUrl } from '../url' |
17 | import { VideoModel } from '../../../models/video/video' | ||
17 | 18 | ||
18 | async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) { | 19 | async function processCreateActivity (activity: ActivityCreate, byActor: ActorModel) { |
19 | const activityObject = activity.object | 20 | const activityObject = activity.object |
@@ -87,19 +88,10 @@ async function processCreateDislike (byActor: ActorModel, activity: ActivityCrea | |||
87 | async function processCreateView (byActor: ActorModel, activity: ActivityCreate) { | 88 | async function processCreateView (byActor: ActorModel, activity: ActivityCreate) { |
88 | const view = activity.object as ViewObject | 89 | const view = activity.object as ViewObject |
89 | 90 | ||
90 | const options = { | 91 | const video = await VideoModel.loadByUrl(view.object) |
91 | videoObject: view.object, | 92 | if (!video || video.isOwned() === false) return |
92 | fetchType: 'only-video' as 'only-video' | ||
93 | } | ||
94 | const { video } = await getOrCreateVideoAndAccountAndChannel(options) | ||
95 | 93 | ||
96 | await Redis.Instance.addVideoView(video.id) | 94 | await Redis.Instance.addVideoView(video.id) |
97 | |||
98 | if (video.isOwned()) { | ||
99 | // Don't resend the activity to the sender | ||
100 | const exceptions = [ byActor ] | ||
101 | await forwardVideoRelatedActivity(activity, undefined, exceptions, video) | ||
102 | } | ||
103 | } | 95 | } |
104 | 96 | ||
105 | async function processCacheFile (byActor: ActorModel, activity: ActivityCreate) { | 97 | async function processCacheFile (byActor: ActorModel, activity: ActivityCreate) { |