aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r--server/lib/job-queue/handlers/activitypub-http-fetcher.ts8
1 files changed, 2 insertions, 6 deletions
diff --git a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
index 04b25f955..ab9675cae 100644
--- a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
+++ b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts
@@ -1,12 +1,11 @@
1import * as Bull from 'bull' 1import * as Bull from 'bull'
2import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models' 2import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models'
3import { logger } from '../../../helpers/logger' 3import { logger } from '../../../helpers/logger'
4import { AccountModel } from '../../../models/account/account'
5import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 4import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
6import { VideoModel } from '../../../models/video/video' 5import { VideoModel } from '../../../models/video/video'
7import { VideoCommentModel } from '../../../models/video/video-comment' 6import { VideoCommentModel } from '../../../models/video/video-comment'
8import { VideoShareModel } from '../../../models/video/video-share' 7import { VideoShareModel } from '../../../models/video/video-share'
9import { MAccountDefault, MVideoFullLight } from '../../../types/models' 8import { MVideoFullLight } from '../../../types/models'
10import { crawlCollectionPage } from '../../activitypub/crawl' 9import { crawlCollectionPage } from '../../activitypub/crawl'
11import { createAccountPlaylists } from '../../activitypub/playlists' 10import { createAccountPlaylists } from '../../activitypub/playlists'
12import { processActivities } from '../../activitypub/process' 11import { processActivities } from '../../activitypub/process'
@@ -22,16 +21,13 @@ async function processActivityPubHttpFetcher (job: Bull.Job) {
22 let video: MVideoFullLight 21 let video: MVideoFullLight
23 if (payload.videoId) video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoId) 22 if (payload.videoId) video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoId)
24 23
25 let account: MAccountDefault
26 if (payload.accountId) account = await AccountModel.load(payload.accountId)
27
28 const fetcherType: { [ id in FetchType ]: (items: any[]) => Promise<any> } = { 24 const fetcherType: { [ id in FetchType ]: (items: any[]) => Promise<any> } = {
29 'activity': items => processActivities(items, { outboxUrl: payload.uri, fromFetch: true }), 25 'activity': items => processActivities(items, { outboxUrl: payload.uri, fromFetch: true }),
30 'video-likes': items => createRates(items, video, 'like'), 26 'video-likes': items => createRates(items, video, 'like'),
31 'video-dislikes': items => createRates(items, video, 'dislike'), 27 'video-dislikes': items => createRates(items, video, 'dislike'),
32 'video-shares': items => addVideoShares(items, video), 28 'video-shares': items => addVideoShares(items, video),
33 'video-comments': items => addVideoComments(items), 29 'video-comments': items => addVideoComments(items),
34 'account-playlists': items => createAccountPlaylists(items, account) 30 'account-playlists': items => createAccountPlaylists(items)
35 } 31 }
36 32
37 const cleanerType: { [ id in FetchType ]?: (crawlStartDate: Date) => Promise<any> } = { 33 const cleanerType: { [ id in FetchType ]?: (crawlStartDate: Date) => Promise<any> } = {