From 7a7724e66e4533523083e7336cd0d0c747c4a33b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 13 Nov 2017 17:39:41 +0100 Subject: Handle follow/accept --- server/helpers/utils.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'server/helpers/utils.ts') diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts index 0ebbf48a8..39957c90f 100644 --- a/server/helpers/utils.ts +++ b/server/helpers/utils.ts @@ -5,6 +5,7 @@ import { pseudoRandomBytesPromise } from './core-utils' import { CONFIG, database as db } from '../initializers' import { ResultList } from '../../shared' import { VideoResolution } from '../../shared/models/videos/video-resolution.enum' +import { AccountInstance } from '../models/account/account-interface' function badRequest (req: express.Request, res: express.Response, next: express.NextFunction) { return res.type('json').status(400).end() @@ -78,6 +79,15 @@ function resetSequelizeInstance (instance: Sequelize.Instance, savedFields: }) } +let applicationAccount: AccountInstance +async function getApplicationAccount () { + if (applicationAccount === undefined) { + applicationAccount = await db.Account.loadApplication() + } + + return Promise.resolve(applicationAccount) +} + type SortType = { sortModel: any, sortValue: string } // --------------------------------------------------------------------------- @@ -89,5 +99,6 @@ export { isSignupAllowed, computeResolutionsToTranscode, resetSequelizeInstance, + getApplicationAccount, SortType } -- cgit v1.2.3