From 2ec349aa857b0bd8f26de5cd78981d60c9b98a69 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 17 Aug 2022 14:52:23 +0200 Subject: Prefer using our pick function --- server/helpers/ffmpeg/ffmpeg-presets.ts | 2 +- server/lib/activitypub/playlists/shared/url-to-object.ts | 2 +- server/lib/emailer.ts | 7 +++---- server/models/video/sql/video/video-model-get-query-builder.ts | 2 +- server/models/video/sql/video/videos-id-list-query-builder.ts | 5 ++++- server/models/video/sql/video/videos-model-list-query-builder.ts | 2 +- shared/server-commands/videos/comments-command.ts | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/server/helpers/ffmpeg/ffmpeg-presets.ts b/server/helpers/ffmpeg/ffmpeg-presets.ts index 99b39f79a..d1160a4a2 100644 --- a/server/helpers/ffmpeg/ffmpeg-presets.ts +++ b/server/helpers/ffmpeg/ffmpeg-presets.ts @@ -1,6 +1,6 @@ import { FfmpegCommand } from 'fluent-ffmpeg' -import { pick } from 'lodash' import { logger, loggerTagsFactory } from '@server/helpers/logger' +import { pick } from '@shared/core-utils' import { AvailableEncoders, EncoderOptions } from '@shared/models' import { buildStreamSuffix, getScaleFilter, StreamType } from './ffmpeg-commons' import { getEncoderBuilderResult } from './ffmpeg-encoders' diff --git a/server/lib/activitypub/playlists/shared/url-to-object.ts b/server/lib/activitypub/playlists/shared/url-to-object.ts index f895db587..41bee3752 100644 --- a/server/lib/activitypub/playlists/shared/url-to-object.ts +++ b/server/lib/activitypub/playlists/shared/url-to-object.ts @@ -1,5 +1,5 @@ -import { isArray } from 'lodash' import { isPlaylistElementObjectValid, isPlaylistObjectValid } from '@server/helpers/custom-validators/activitypub/playlist' +import { isArray } from '@server/helpers/custom-validators/misc' import { logger, loggerTagsFactory } from '@server/helpers/logger' import { doJSONRequest } from '@server/helpers/requests' import { PlaylistElementObject, PlaylistObject } from '@shared/models' diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index 9e546de7f..3cdba5c76 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts @@ -1,7 +1,8 @@ import { readFileSync } from 'fs-extra' -import { isArray, merge } from 'lodash' +import { merge } from 'lodash' import { createTransport, Transporter } from 'nodemailer' import { join } from 'path' +import { toArray } from '@server/helpers/custom-validators/misc' import { root } from '@shared/core-utils' import { EmailPayload } from '@shared/models' import { SendEmailDefaultOptions } from '../../shared/models/server/emailer.model' @@ -158,9 +159,7 @@ class Emailer { subjectPrefix: CONFIG.EMAIL.SUBJECT.PREFIX }) - const toEmails = isArray(options.to) - ? options.to - : [ options.to ] + const toEmails = toArray(options.to) for (const to of toEmails) { const baseOptions: SendEmailDefaultOptions = { diff --git a/server/models/video/sql/video/video-model-get-query-builder.ts b/server/models/video/sql/video/video-model-get-query-builder.ts index 29e59c8be..8e90ff641 100644 --- a/server/models/video/sql/video/video-model-get-query-builder.ts +++ b/server/models/video/sql/video/video-model-get-query-builder.ts @@ -1,5 +1,5 @@ -import { pick } from 'lodash' import { Sequelize, Transaction } from 'sequelize' +import { pick } from '@shared/core-utils' import { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder' import { VideoFileQueryBuilder } from './shared/video-file-query-builder' import { VideoModelBuilder } from './shared/video-model-builder' diff --git a/server/models/video/sql/video/videos-id-list-query-builder.ts b/server/models/video/sql/video/videos-id-list-query-builder.ts index 8692a436a..14f903851 100644 --- a/server/models/video/sql/video/videos-id-list-query-builder.ts +++ b/server/models/video/sql/video/videos-id-list-query-builder.ts @@ -1,4 +1,4 @@ -import { Sequelize } from 'sequelize' +import { Sequelize, Transaction } from 'sequelize' import validator from 'validator' import { exists } from '@server/helpers/custom-validators/misc' import { WEBSERVER } from '@server/initializers/constants' @@ -73,6 +73,9 @@ export type BuildVideosListQueryOptions = { group?: string having?: string + + transaction?: Transaction + logging?: boolean } export class VideosIdListQueryBuilder extends AbstractRunQuery { diff --git a/server/models/video/sql/video/videos-model-list-query-builder.ts b/server/models/video/sql/video/videos-model-list-query-builder.ts index 4fe6bc321..3fdac4ed3 100644 --- a/server/models/video/sql/video/videos-model-list-query-builder.ts +++ b/server/models/video/sql/video/videos-model-list-query-builder.ts @@ -1,5 +1,5 @@ -import { pick } from 'lodash' import { Sequelize } from 'sequelize' +import { pick } from '@shared/core-utils' import { VideoInclude } from '@shared/models' import { AbstractVideoQueryBuilder } from './shared/abstract-video-query-builder' import { VideoFileQueryBuilder } from './shared/video-file-query-builder' diff --git a/shared/server-commands/videos/comments-command.ts b/shared/server-commands/videos/comments-command.ts index 156cf452f..154ec0c24 100644 --- a/shared/server-commands/videos/comments-command.ts +++ b/shared/server-commands/videos/comments-command.ts @@ -1,4 +1,4 @@ -import { pick } from 'lodash' +import { pick } from '@shared/core-utils' import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models' import { unwrapBody } from '../requests' import { AbstractCommand, OverrideCommandOptions } from '../shared' -- cgit v1.2.3