From 3b46eec8aeb95eb0dce763e3569c0509b1da7607 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 25 Jul 2023 14:26:12 +0200 Subject: [PATCH] Remove unused param --- server/controllers/api/search/search-videos.ts | 1 - server/lib/activitypub/process/process-create.ts | 2 +- server/lib/activitypub/video-comments.ts | 2 +- server/lib/activitypub/videos/get.ts | 4 ++-- server/lib/activitypub/videos/shared/creator.ts | 2 +- .../lib/activitypub/videos/shared/video-sync-attributes.ts | 7 +++++-- server/lib/job-queue/handlers/activitypub-refresher.ts | 2 +- server/lib/schedulers/videos-redundancy-scheduler.ts | 2 +- 8 files changed, 12 insertions(+), 10 deletions(-) diff --git a/server/controllers/api/search/search-videos.ts b/server/controllers/api/search/search-videos.ts index 034a63ace..d0ab7f12a 100644 --- a/server/controllers/api/search/search-videos.ts +++ b/server/controllers/api/search/search-videos.ts @@ -137,7 +137,6 @@ async function searchVideoURI (url: string, res: express.Response) { rates: false, shares: false, comments: false, - thumbnail: true, refreshVideo: false } diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index e89d1ab45..2e64d981e 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts @@ -70,7 +70,7 @@ export { // --------------------------------------------------------------------------- async function processCreateVideo (videoToCreateData: VideoObject, notify: boolean) { - const syncParam = { rates: false, shares: false, comments: false, thumbnail: true, refreshVideo: false } + const syncParam = { rates: false, shares: false, comments: false, refreshVideo: false } const { video, created } = await getOrCreateAPVideo({ videoObject: videoToCreateData, syncParam }) if (created && notify) Notifier.Instance.notifyOnNewVideoIfNeeded(video) diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index b65baf0e9..4fdb4e0b7 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts @@ -89,7 +89,7 @@ async function tryToResolveThreadFromVideo (params: ResolveThreadParams) { // Maybe it's a reply to a video? // If yes, it's done: we resolved all the thread - const syncParam = { rates: true, shares: true, comments: false, thumbnail: true, refreshVideo: false } + const syncParam = { rates: true, shares: true, comments: false, refreshVideo: false } const { video } = await getOrCreateAPVideo({ videoObject: url, syncParam }) if (video.isOwned() && !video.hasPrivacyForFederation()) { diff --git a/server/lib/activitypub/videos/get.ts b/server/lib/activitypub/videos/get.ts index 92387c5d4..288c506ee 100644 --- a/server/lib/activitypub/videos/get.ts +++ b/server/lib/activitypub/videos/get.ts @@ -43,7 +43,7 @@ async function getOrCreateAPVideo ( options: GetVideoParamAll | GetVideoParamImmutable | GetVideoParamOther ): GetVideoResult { // Default params - const syncParam = options.syncParam || { rates: true, shares: true, comments: true, thumbnail: true, refreshVideo: false } + const syncParam = options.syncParam || { rates: true, shares: true, comments: true, refreshVideo: false } const fetchType = options.fetchType || 'all' const allowRefresh = options.allowRefresh !== false @@ -68,7 +68,7 @@ async function getOrCreateAPVideo ( try { const creator = new APVideoCreator(videoObject) - const { autoBlacklisted, videoCreated } = await retryTransactionWrapper(creator.create.bind(creator), syncParam.thumbnail) + const { autoBlacklisted, videoCreated } = await retryTransactionWrapper(creator.create.bind(creator)) await syncVideoExternalAttributes(videoCreated, videoObject, syncParam) diff --git a/server/lib/activitypub/videos/shared/creator.ts b/server/lib/activitypub/videos/shared/creator.ts index 512d14d82..e44fd0d52 100644 --- a/server/lib/activitypub/videos/shared/creator.ts +++ b/server/lib/activitypub/videos/shared/creator.ts @@ -18,7 +18,7 @@ export class APVideoCreator extends APVideoAbstractBuilder { this.lTags = loggerTagsFactory('ap', 'video', 'create', this.videoObject.uuid, this.videoObject.id) } - async create (waitThumbnail = false) { + async create () { logger.debug('Adding remote video %s.', this.videoObject.id, this.lTags()) const channelActor = await this.getOrCreateVideoChannelFromVideoObject() diff --git a/server/lib/activitypub/videos/shared/video-sync-attributes.ts b/server/lib/activitypub/videos/shared/video-sync-attributes.ts index e3cb96a62..aa37f3d34 100644 --- a/server/lib/activitypub/videos/shared/video-sync-attributes.ts +++ b/server/lib/activitypub/videos/shared/video-sync-attributes.ts @@ -17,11 +17,14 @@ type SyncParam = { rates: boolean shares: boolean comments: boolean - thumbnail: boolean refreshVideo?: boolean } -async function syncVideoExternalAttributes (video: MVideo, fetchedVideo: VideoObject, syncParam: SyncParam) { +async function syncVideoExternalAttributes ( + video: MVideo, + fetchedVideo: VideoObject, + syncParam: Pick +) { logger.info('Adding likes/dislikes/shares/comments of video %s.', video.uuid) const ratePromise = updateVideoRates(video, fetchedVideo) diff --git a/server/lib/job-queue/handlers/activitypub-refresher.ts b/server/lib/job-queue/handlers/activitypub-refresher.ts index 307e771ff..706bf17fa 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 = { rates: true, shares: true, comments: true, thumbnail: true } + const syncParam = { rates: true, shares: true, comments: true } const videoFromDatabase = await loadVideoByUrl(videoUrl, fetchType) if (videoFromDatabase) { diff --git a/server/lib/schedulers/videos-redundancy-scheduler.ts b/server/lib/schedulers/videos-redundancy-scheduler.ts index 24d340a73..91625ccb5 100644 --- a/server/lib/schedulers/videos-redundancy-scheduler.ts +++ b/server/lib/schedulers/videos-redundancy-scheduler.ts @@ -365,7 +365,7 @@ export class VideosRedundancyScheduler extends AbstractScheduler { // We need more attributes and check if the video still exists const getVideoOptions = { videoObject: videoUrl, - syncParam: { rates: false, shares: false, comments: false, thumbnail: false, refreshVideo: true }, + syncParam: { rates: false, shares: false, comments: false, refreshVideo: true }, fetchType: 'all' as 'all' } const { video } = await getOrCreateAPVideo(getVideoOptions)