diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/activitypub/process/process-create.ts | 3 | ||||
-rw-r--r-- | server/lib/activitypub/process/process-like.ts | 5 |
2 files changed, 3 insertions, 5 deletions
diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index 214e14546..f7fb09fba 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts | |||
@@ -12,7 +12,6 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos' | |||
12 | import { forwardVideoRelatedActivity } from '../send/utils' | 12 | 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' | ||
16 | import { getVideoDislikeActivityPubUrl } from '../url' | 15 | import { getVideoDislikeActivityPubUrl } from '../url' |
17 | import { VideoModel } from '../../../models/video/video' | 16 | import { VideoModel } from '../../../models/video/video' |
18 | 17 | ||
@@ -71,7 +70,7 @@ async function processCreateDislike (byActor: ActorModel, activity: ActivityCrea | |||
71 | 70 | ||
72 | const [ , created ] = await AccountVideoRateModel.findOrCreate({ | 71 | const [ , created ] = await AccountVideoRateModel.findOrCreate({ |
73 | where: rate, | 72 | where: rate, |
74 | defaults: immutableAssign(rate, { url: getVideoDislikeActivityPubUrl(byActor, video) }), | 73 | defaults: Object.assign({}, rate, { url: getVideoDislikeActivityPubUrl(byActor, video) }), |
75 | transaction: t | 74 | transaction: t |
76 | }) | 75 | }) |
77 | if (created === true) await video.increment('dislikes', { transaction: t }) | 76 | if (created === true) await video.increment('dislikes', { transaction: t }) |
diff --git a/server/lib/activitypub/process/process-like.ts b/server/lib/activitypub/process/process-like.ts index 0dca17551..e8e97eece 100644 --- a/server/lib/activitypub/process/process-like.ts +++ b/server/lib/activitypub/process/process-like.ts | |||
@@ -5,8 +5,7 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat | |||
5 | import { ActorModel } from '../../../models/activitypub/actor' | 5 | import { ActorModel } from '../../../models/activitypub/actor' |
6 | import { forwardVideoRelatedActivity } from '../send/utils' | 6 | import { forwardVideoRelatedActivity } from '../send/utils' |
7 | import { getOrCreateVideoAndAccountAndChannel } from '../videos' | 7 | import { getOrCreateVideoAndAccountAndChannel } from '../videos' |
8 | import { immutableAssign } from '../../../tests/utils' | 8 | import { getVideoLikeActivityPubUrl } from '../url' |
9 | import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' | ||
10 | 9 | ||
11 | async function processLikeActivity (activity: ActivityLike, byActor: ActorModel) { | 10 | async function processLikeActivity (activity: ActivityLike, byActor: ActorModel) { |
12 | return retryTransactionWrapper(processLikeVideo, byActor, activity) | 11 | return retryTransactionWrapper(processLikeVideo, byActor, activity) |
@@ -36,7 +35,7 @@ async function processLikeVideo (byActor: ActorModel, activity: ActivityLike) { | |||
36 | } | 35 | } |
37 | const [ , created ] = await AccountVideoRateModel.findOrCreate({ | 36 | const [ , created ] = await AccountVideoRateModel.findOrCreate({ |
38 | where: rate, | 37 | where: rate, |
39 | defaults: immutableAssign(rate, { url: getVideoLikeActivityPubUrl(byActor, video) }), | 38 | defaults: Object.assign({}, rate, { url: getVideoLikeActivityPubUrl(byActor, video) }), |
40 | transaction: t | 39 | transaction: t |
41 | }) | 40 | }) |
42 | if (created === true) await video.increment('likes', { transaction: t }) | 41 | if (created === true) await video.increment('likes', { transaction: t }) |