Don't import test tools in core
This commit is contained in:
parent
6cc98dfff3
commit
a8f378e02c
|
@ -12,7 +12,6 @@ import { getOrCreateVideoAndAccountAndChannel } from '../videos'
|
||||||
import { forwardVideoRelatedActivity } from '../send/utils'
|
import { forwardVideoRelatedActivity } from '../send/utils'
|
||||||
import { Redis } from '../../redis'
|
import { Redis } from '../../redis'
|
||||||
import { createOrUpdateCacheFile } from '../cache-file'
|
import { createOrUpdateCacheFile } from '../cache-file'
|
||||||
import { immutableAssign } from '../../../tests/utils'
|
|
||||||
import { getVideoDislikeActivityPubUrl } from '../url'
|
import { getVideoDislikeActivityPubUrl } from '../url'
|
||||||
import { VideoModel } from '../../../models/video/video'
|
import { VideoModel } from '../../../models/video/video'
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ async function processCreateDislike (byActor: ActorModel, activity: ActivityCrea
|
||||||
|
|
||||||
const [ , created ] = await AccountVideoRateModel.findOrCreate({
|
const [ , created ] = await AccountVideoRateModel.findOrCreate({
|
||||||
where: rate,
|
where: rate,
|
||||||
defaults: immutableAssign(rate, { url: getVideoDislikeActivityPubUrl(byActor, video) }),
|
defaults: Object.assign({}, rate, { url: getVideoDislikeActivityPubUrl(byActor, video) }),
|
||||||
transaction: t
|
transaction: t
|
||||||
})
|
})
|
||||||
if (created === true) await video.increment('dislikes', { transaction: t })
|
if (created === true) await video.increment('dislikes', { transaction: t })
|
||||||
|
|
|
@ -5,8 +5,7 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat
|
||||||
import { ActorModel } from '../../../models/activitypub/actor'
|
import { ActorModel } from '../../../models/activitypub/actor'
|
||||||
import { forwardVideoRelatedActivity } from '../send/utils'
|
import { forwardVideoRelatedActivity } from '../send/utils'
|
||||||
import { getOrCreateVideoAndAccountAndChannel } from '../videos'
|
import { getOrCreateVideoAndAccountAndChannel } from '../videos'
|
||||||
import { immutableAssign } from '../../../tests/utils'
|
import { getVideoLikeActivityPubUrl } from '../url'
|
||||||
import { getVideoDislikeActivityPubUrl, getVideoLikeActivityPubUrl } from '../url'
|
|
||||||
|
|
||||||
async function processLikeActivity (activity: ActivityLike, byActor: ActorModel) {
|
async function processLikeActivity (activity: ActivityLike, byActor: ActorModel) {
|
||||||
return retryTransactionWrapper(processLikeVideo, byActor, activity)
|
return retryTransactionWrapper(processLikeVideo, byActor, activity)
|
||||||
|
@ -36,7 +35,7 @@ async function processLikeVideo (byActor: ActorModel, activity: ActivityLike) {
|
||||||
}
|
}
|
||||||
const [ , created ] = await AccountVideoRateModel.findOrCreate({
|
const [ , created ] = await AccountVideoRateModel.findOrCreate({
|
||||||
where: rate,
|
where: rate,
|
||||||
defaults: immutableAssign(rate, { url: getVideoLikeActivityPubUrl(byActor, video) }),
|
defaults: Object.assign({}, rate, { url: getVideoLikeActivityPubUrl(byActor, video) }),
|
||||||
transaction: t
|
transaction: t
|
||||||
})
|
})
|
||||||
if (created === true) await video.increment('likes', { transaction: t })
|
if (created === true) await video.increment('likes', { transaction: t })
|
||||||
|
|
Loading…
Reference in New Issue