From a8f378e02c1b0dbb6d6ac202a369d0df18eb9317 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 22 Nov 2018 15:30:41 +0100 Subject: [PATCH] Don't import test tools in core --- server/lib/activitypub/process/process-create.ts | 3 +-- 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' import { forwardVideoRelatedActivity } from '../send/utils' import { Redis } from '../../redis' import { createOrUpdateCacheFile } from '../cache-file' -import { immutableAssign } from '../../../tests/utils' import { getVideoDislikeActivityPubUrl } from '../url' import { VideoModel } from '../../../models/video/video' @@ -71,7 +70,7 @@ async function processCreateDislike (byActor: ActorModel, activity: ActivityCrea const [ , created ] = await AccountVideoRateModel.findOrCreate({ where: rate, - defaults: immutableAssign(rate, { url: getVideoDislikeActivityPubUrl(byActor, video) }), + defaults: Object.assign({}, rate, { url: getVideoDislikeActivityPubUrl(byActor, video) }), transaction: t }) 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 import { ActorModel } from '../../../models/activitypub/actor' import { forwardVideoRelatedActivity } from '../send/utils' import { getOrCreateVideoAndAccountAndChannel } from '../videos' -import { immutableAssign } from '../../../tests/utils' -import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url' +import { getVideoLikeActivityPubUrl } from '../url' async function processLikeActivity (activity: ActivityLike, byActor: ActorModel) { return retryTransactionWrapper(processLikeVideo, byActor, activity) @@ -36,7 +35,7 @@ async function processLikeVideo (byActor: ActorModel, activity: ActivityLike) { } const [ , created ] = await AccountVideoRateModel.findOrCreate({ where: rate, - defaults: immutableAssign(rate, { url: getVideoLikeActivityPubUrl(byActor, video) }), + defaults: Object.assign({}, rate, { url: getVideoLikeActivityPubUrl(byActor, video) }), transaction: t }) if (created === true) await video.increment('likes', { transaction: t }) -- 2.25.1