aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/utils.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-13 17:39:41 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit7a7724e66e4533523083e7336cd0d0c747c4a33b (patch)
tree805299eb9c6829158cd17e5a823a84a3a54d8209 /server/helpers/utils.ts
parent571389d43b8fc8aaf27e77c06f19b320b08dbbc9 (diff)
downloadPeerTube-7a7724e66e4533523083e7336cd0d0c747c4a33b.tar.gz
PeerTube-7a7724e66e4533523083e7336cd0d0c747c4a33b.tar.zst
PeerTube-7a7724e66e4533523083e7336cd0d0c747c4a33b.zip
Handle follow/accept
Diffstat (limited to 'server/helpers/utils.ts')
-rw-r--r--server/helpers/utils.ts11
1 files changed, 11 insertions, 0 deletions
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'
5import { CONFIG, database as db } from '../initializers' 5import { CONFIG, database as db } from '../initializers'
6import { ResultList } from '../../shared' 6import { ResultList } from '../../shared'
7import { VideoResolution } from '../../shared/models/videos/video-resolution.enum' 7import { VideoResolution } from '../../shared/models/videos/video-resolution.enum'
8import { AccountInstance } from '../models/account/account-interface'
8 9
9function badRequest (req: express.Request, res: express.Response, next: express.NextFunction) { 10function badRequest (req: express.Request, res: express.Response, next: express.NextFunction) {
10 return res.type('json').status(400).end() 11 return res.type('json').status(400).end()
@@ -78,6 +79,15 @@ function resetSequelizeInstance (instance: Sequelize.Instance<any>, savedFields:
78 }) 79 })
79} 80}
80 81
82let applicationAccount: AccountInstance
83async function getApplicationAccount () {
84 if (applicationAccount === undefined) {
85 applicationAccount = await db.Account.loadApplication()
86 }
87
88 return Promise.resolve(applicationAccount)
89}
90
81type SortType = { sortModel: any, sortValue: string } 91type SortType = { sortModel: any, sortValue: string }
82 92
83// --------------------------------------------------------------------------- 93// ---------------------------------------------------------------------------
@@ -89,5 +99,6 @@ export {
89 isSignupAllowed, 99 isSignupAllowed,
90 computeResolutionsToTranscode, 100 computeResolutionsToTranscode,
91 resetSequelizeInstance, 101 resetSequelizeInstance,
102 getApplicationAccount,
92 SortType 103 SortType
93} 104}