diff options
Diffstat (limited to 'server/lib/activitypub/process/process-like.ts')
-rw-r--r-- | server/lib/activitypub/process/process-like.ts | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/server/lib/activitypub/process/process-like.ts b/server/lib/activitypub/process/process-like.ts index 9e1664fd8..f7200db61 100644 --- a/server/lib/activitypub/process/process-like.ts +++ b/server/lib/activitypub/process/process-like.ts | |||
@@ -3,14 +3,11 @@ import { retryTransactionWrapper } from '../../../helpers/database-utils' | |||
3 | import { sequelizeTypescript } from '../../../initializers' | 3 | import { sequelizeTypescript } from '../../../initializers' |
4 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | 4 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' |
5 | import { ActorModel } from '../../../models/activitypub/actor' | 5 | import { ActorModel } from '../../../models/activitypub/actor' |
6 | import { getOrCreateActorAndServerAndModel } from '../actor' | ||
7 | import { forwardVideoRelatedActivity } from '../send/utils' | 6 | import { forwardVideoRelatedActivity } from '../send/utils' |
8 | import { getOrCreateVideoAndAccountAndChannel } from '../videos' | 7 | import { getOrCreateVideoAndAccountAndChannel } from '../videos' |
9 | 8 | ||
10 | async function processLikeActivity (activity: ActivityLike) { | 9 | async function processLikeActivity (activity: ActivityLike, byActor: ActorModel) { |
11 | const actor = await getOrCreateActorAndServerAndModel(activity.actor) | 10 | return retryTransactionWrapper(processLikeVideo, byActor, activity) |
12 | |||
13 | return retryTransactionWrapper(processLikeVideo, actor, activity) | ||
14 | } | 11 | } |
15 | 12 | ||
16 | // --------------------------------------------------------------------------- | 13 | // --------------------------------------------------------------------------- |
@@ -27,7 +24,7 @@ async function processLikeVideo (byActor: ActorModel, activity: ActivityLike) { | |||
27 | const byAccount = byActor.Account | 24 | const byAccount = byActor.Account |
28 | if (!byAccount) throw new Error('Cannot create like with the non account actor ' + byActor.url) | 25 | if (!byAccount) throw new Error('Cannot create like with the non account actor ' + byActor.url) |
29 | 26 | ||
30 | const { video } = await getOrCreateVideoAndAccountAndChannel(videoUrl) | 27 | const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: videoUrl }) |
31 | 28 | ||
32 | return sequelizeTypescript.transaction(async t => { | 29 | return sequelizeTypescript.transaction(async t => { |
33 | const rate = { | 30 | const rate = { |