From 9d8ef212ff46cc1b96dc407a85e7486f185c5179 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 9 Feb 2022 17:48:15 +0100 Subject: Fix broken dep --- server/lib/auth/oauth-model.ts | 3 ++- server/models/user/user.ts | 6 +++--- server/models/utils.ts | 5 ++--- server/models/video/video-file.ts | 5 ++--- 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'server') diff --git a/server/lib/auth/oauth-model.ts b/server/lib/auth/oauth-model.ts index 81b6529d8..5d68f44e9 100644 --- a/server/lib/auth/oauth-model.ts +++ b/server/lib/auth/oauth-model.ts @@ -9,9 +9,9 @@ import { UserAdminFlag } from '@shared/models/users/user-flag.model' import { UserRole } from '@shared/models/users/user-role' import { logger } from '../../helpers/logger' import { CONFIG } from '../../initializers/config' -import { UserModel } from '../../models/user/user' import { OAuthClientModel } from '../../models/oauth/oauth-client' import { OAuthTokenModel } from '../../models/oauth/oauth-token' +import { UserModel } from '../../models/user/user' import { createUserAccountAndChannelAndPlaylist } from '../user' import { TokensCache } from './tokens-cache' @@ -116,6 +116,7 @@ async function getUser (usernameOrEmail?: string, password?: string, bypassLogin logger.debug('Getting User (username/email: ' + usernameOrEmail + ', password: ******).') const user = await UserModel.loadByUsernameOrEmail(usernameOrEmail) + // If we don't find the user, or if the user belongs to a plugin if (!user || user.pluginAuth !== null || !password) return null diff --git a/server/models/user/user.ts b/server/models/user/user.ts index e7bf22806..ad8ce08cb 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts @@ -48,14 +48,14 @@ import { isUserEmailVerifiedValid, isUserNoModal, isUserNSFWPolicyValid, + isUserP2PEnabledValid, isUserPasswordValid, isUserRoleValid, isUserUsernameValid, isUserVideoLanguages, isUserVideoQuotaDailyValid, isUserVideoQuotaValid, - isUserVideosHistoryEnabledValid, - isUserP2PEnabledValid + isUserVideosHistoryEnabledValid } from '../../helpers/custom-validators/users' import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' @@ -623,7 +623,7 @@ export class UserModel extends Model>> { const query = { where: { [Op.or]: [ - where(fn('lower', col('username')), '=', fn('lower', username)), + where(fn('lower', col('username')), fn('lower', username) as any), { email } ] diff --git a/server/models/utils.ts b/server/models/utils.ts index 0950f5f32..66b653e3d 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts @@ -1,5 +1,4 @@ import { literal, Op, OrderItem, Sequelize } from 'sequelize' -import { Col } from 'sequelize/types/utils' import validator from 'validator' type SortType = { sortModel: string, sortValue: string } @@ -8,7 +7,7 @@ type SortType = { sortModel: string, sortValue: string } function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { const { direction, field } = buildDirectionAndField(value) - let finalField: string | Col + let finalField: string | ReturnType if (field.toLowerCase() === 'match') { // Search finalField = Sequelize.col('similarity') @@ -65,7 +64,7 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or ] } - let finalField: string | Col + let finalField: string | ReturnType // Alias if (field.toLowerCase() === 'match') { // Search diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 1a9f4561a..fae76c6f2 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts @@ -1,7 +1,7 @@ import { remove } from 'fs-extra' import memoizee from 'memoizee' import { join } from 'path' -import { FindOptions, Op, Transaction } from 'sequelize' +import { FindOptions, Op, Transaction, WhereOptions } from 'sequelize' import { AllowNull, BelongsTo, @@ -18,7 +18,6 @@ import { Table, UpdatedAt } from 'sequelize-typescript' -import { Where } from 'sequelize/types/utils' import validator from 'validator' import { buildRemoteVideoBaseUrl } from '@server/helpers/activitypub' import { logger } from '@server/helpers/logger' @@ -70,7 +69,7 @@ export enum ScopeNames { } ] }, - [ScopeNames.WITH_VIDEO_OR_PLAYLIST]: (options: { whereVideo?: Where } = {}) => { + [ScopeNames.WITH_VIDEO_OR_PLAYLIST]: (options: { whereVideo?: WhereOptions } = {}) => { return { include: [ { -- cgit v1.2.3