From 57cfff78858b2360d9e038e2a504b761cb51da47 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 May 2019 14:02:26 +0200 Subject: Remove unused actor uuid field --- server/helpers/custom-validators/accounts.ts | 11 ++--------- server/helpers/custom-validators/video-channels.ts | 9 ++------- 2 files changed, 4 insertions(+), 16 deletions(-) (limited to 'server/helpers/custom-validators') diff --git a/server/helpers/custom-validators/accounts.ts b/server/helpers/custom-validators/accounts.ts index 146c7708e..31a2de5ca 100644 --- a/server/helpers/custom-validators/accounts.ts +++ b/server/helpers/custom-validators/accounts.ts @@ -1,7 +1,6 @@ import * as Bluebird from 'bluebird' import { Response } from 'express' import 'express-validator' -import * as validator from 'validator' import { AccountModel } from '../../models/account/account' import { isUserDescriptionValid, isUserUsernameValid } from './users' import { exists } from './misc' @@ -18,14 +17,8 @@ function isAccountDescriptionValid (value: string) { return isUserDescriptionValid(value) } -function doesAccountIdExist (id: number | string, res: Response, sendNotFound = true) { - let promise: Bluebird - - if (validator.isInt('' + id)) { - promise = AccountModel.load(+id) - } else { // UUID - promise = AccountModel.loadByUUID('' + id) - } +function doesAccountIdExist (id: number, res: Response, sendNotFound = true) { + const promise = AccountModel.load(id) return doesAccountExist(promise, res, sendNotFound) } diff --git a/server/helpers/custom-validators/video-channels.ts b/server/helpers/custom-validators/video-channels.ts index fd56b9a70..f818ce8f1 100644 --- a/server/helpers/custom-validators/video-channels.ts +++ b/server/helpers/custom-validators/video-channels.ts @@ -26,13 +26,8 @@ async function doesLocalVideoChannelNameExist (name: string, res: express.Respon return processVideoChannelExist(videoChannel, res) } -async function doesVideoChannelIdExist (id: number | string, res: express.Response) { - let videoChannel: VideoChannelModel - if (validator.isInt('' + id)) { - videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id) - } else { // UUID - videoChannel = await VideoChannelModel.loadByUUIDAndPopulateAccount('' + id) - } +async function doesVideoChannelIdExist (id: number, res: express.Response) { + const videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id) return processVideoChannelExist(videoChannel, res) } -- cgit v1.2.3