aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-11-22 15:30:41 +0100
committerChocobozzz <me@florianbigard.com>2018-11-22 15:30:41 +0100
commita8f378e02c1b0dbb6d6ac202a369d0df18eb9317 (patch)
tree83fed4829250b63e534af6d2403ae4f9818c27b8 /server
parent6cc98dfff3d021c0c75e618e251fc99706459bf2 (diff)
downloadPeerTube-a8f378e02c1b0dbb6d6ac202a369d0df18eb9317.tar.gz
PeerTube-a8f378e02c1b0dbb6d6ac202a369d0df18eb9317.tar.zst
PeerTube-a8f378e02c1b0dbb6d6ac202a369d0df18eb9317.zip
Don't import test tools in core
Diffstat (limited to 'server')
-rw-r--r--server/lib/activitypub/process/process-create.ts3
-rw-r--r--server/lib/activitypub/process/process-like.ts5
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'
12import { forwardVideoRelatedActivity } from '../send/utils' 12import { forwardVideoRelatedActivity } from '../send/utils'
13import { Redis } from '../../redis' 13import { Redis } from '../../redis'
14import { createOrUpdateCacheFile } from '../cache-file' 14import { createOrUpdateCacheFile } from '../cache-file'
15import { immutableAssign } from '../../../tests/utils'
16import { getVideoDislikeActivityPubUrl } from '../url' 15import { getVideoDislikeActivityPubUrl } from '../url'
17import { VideoModel } from '../../../models/video/video' 16import { 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
5import { ActorModel } from '../../../models/activitypub/actor' 5import { ActorModel } from '../../../models/activitypub/actor'
6import { forwardVideoRelatedActivity } from '../send/utils' 6import { forwardVideoRelatedActivity } from '../send/utils'
7import { getOrCreateVideoAndAccountAndChannel } from '../videos' 7import { getOrCreateVideoAndAccountAndChannel } from '../videos'
8import { immutableAssign } from '../../../tests/utils' 8import { getVideoLikeActivityPubUrl } from '../url'
9import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url'
10 9
11async function processLikeActivity (activity: ActivityLike, byActor: ActorModel) { 10async 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 })