From 57e4e1c1a95c3a81a967f54ecc2a510d8b0e129c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 18 Mar 2022 11:17:35 +0100 Subject: Don't store remote rates of remote videos In the future we'll stop to expose all available rates to improve users privacy --- server/lib/job-queue/handlers/activitypub-cleaner.ts | 2 +- server/lib/job-queue/handlers/activitypub-http-fetcher.ts | 6 ------ server/lib/job-queue/handlers/activitypub-refresher.ts | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) (limited to 'server/lib/job-queue/handlers') diff --git a/server/lib/job-queue/handlers/activitypub-cleaner.ts b/server/lib/job-queue/handlers/activitypub-cleaner.ts index 509dd1cb5..07dd908cd 100644 --- a/server/lib/job-queue/handlers/activitypub-cleaner.ts +++ b/server/lib/job-queue/handlers/activitypub-cleaner.ts @@ -34,7 +34,7 @@ async function processActivityPubCleaner (_job: Job) { if (result?.status === 'deleted') { const { videoId, type } = result.data - await VideoModel.updateRatesOf(videoId, type, undefined) + await VideoModel.syncLocalRates(videoId, type, undefined) } }, { concurrency: AP_CLEANER.CONCURRENCY }) } diff --git a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts index 46016a0a7..128e14f94 100644 --- a/server/lib/job-queue/handlers/activitypub-http-fetcher.ts +++ b/server/lib/job-queue/handlers/activitypub-http-fetcher.ts @@ -1,7 +1,6 @@ import { Job } from 'bull' import { ActivitypubHttpFetcherPayload, FetchType } from '@shared/models' import { logger } from '../../../helpers/logger' -import { AccountVideoRateModel } from '../../../models/account/account-video-rate' import { VideoModel } from '../../../models/video/video' import { VideoCommentModel } from '../../../models/video/video-comment' import { VideoShareModel } from '../../../models/video/video-share' @@ -11,7 +10,6 @@ import { createAccountPlaylists } from '../../activitypub/playlists' import { processActivities } from '../../activitypub/process' import { addVideoShares } from '../../activitypub/share' import { addVideoComments } from '../../activitypub/video-comments' -import { createRates } from '../../activitypub/video-rates' async function processActivityPubHttpFetcher (job: Job) { logger.info('Processing ActivityPub fetcher in job %d.', job.id) @@ -23,16 +21,12 @@ async function processActivityPubHttpFetcher (job: Job) { const fetcherType: { [ id in FetchType ]: (items: any[]) => Promise } = { 'activity': items => processActivities(items, { outboxUrl: payload.uri, fromFetch: true }), - 'video-likes': items => createRates(items, video, 'like'), - 'video-dislikes': items => createRates(items, video, 'dislike'), 'video-shares': items => addVideoShares(items, video), 'video-comments': items => addVideoComments(items), 'account-playlists': items => createAccountPlaylists(items) } const cleanerType: { [ id in FetchType ]?: (crawlStartDate: Date) => Promise } = { - 'video-likes': crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, 'like' as 'like', crawlStartDate), - 'video-dislikes': crawlStartDate => AccountVideoRateModel.cleanOldRatesOf(video.id, 'dislike' as 'dislike', crawlStartDate), 'video-shares': crawlStartDate => VideoShareModel.cleanOldSharesOf(video.id, crawlStartDate), 'video-comments': crawlStartDate => VideoCommentModel.cleanOldCommentsOf(video.id, crawlStartDate) } diff --git a/server/lib/job-queue/handlers/activitypub-refresher.ts b/server/lib/job-queue/handlers/activitypub-refresher.ts index 5037992d2..92ceed180 100644 --- a/server/lib/job-queue/handlers/activitypub-refresher.ts +++ b/server/lib/job-queue/handlers/activitypub-refresher.ts @@ -28,7 +28,7 @@ export { async function refreshVideo (videoUrl: string) { const fetchType = 'all' as 'all' - const syncParam = { likes: true, dislikes: true, shares: true, comments: true, thumbnail: true } + const syncParam = { rates: true, shares: true, comments: true, thumbnail: true } const videoFromDatabase = await loadVideoByUrl(videoUrl, fetchType) if (videoFromDatabase) { -- cgit v1.2.3