aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/user.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/user.ts')
-rw-r--r--server/lib/user.ts17
1 files changed, 8 insertions, 9 deletions
diff --git a/server/lib/user.ts b/server/lib/user.ts
index 5653d8e65..c4722fae2 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -1,14 +1,13 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto' 2import { createPrivateAndPublicKeys, logger } from '../helpers'
3import { database as db } from '../initializers' 3import { CONFIG, sequelizeTypescript } from '../initializers'
4import { CONFIG } from '../initializers/constants' 4import { AccountModel } from '../models/account/account'
5import { UserInstance } from '../models' 5import { UserModel } from '../models/account/user'
6import { getAccountActivityPubUrl } from './activitypub'
6import { createVideoChannel } from './video-channel' 7import { createVideoChannel } from './video-channel'
7import { logger } from '../helpers/logger'
8import { getAccountActivityPubUrl } from './activitypub/url'
9 8
10async function createUserAccountAndChannel (user: UserInstance, validateUser = true) { 9async function createUserAccountAndChannel (user: UserModel, validateUser = true) {
11 const { account, videoChannel } = await db.sequelize.transaction(async t => { 10 const { account, videoChannel } = await sequelizeTypescript.transaction(async t => {
12 const userOptions = { 11 const userOptions = {
13 transaction: t, 12 transaction: t,
14 validate: validateUser 13 validate: validateUser
@@ -38,7 +37,7 @@ async function createUserAccountAndChannel (user: UserInstance, validateUser = t
38async function createLocalAccountWithoutKeys (name: string, userId: number, applicationId: number, t: Sequelize.Transaction) { 37async function createLocalAccountWithoutKeys (name: string, userId: number, applicationId: number, t: Sequelize.Transaction) {
39 const url = getAccountActivityPubUrl(name) 38 const url = getAccountActivityPubUrl(name)
40 39
41 const accountInstance = db.Account.build({ 40 const accountInstance = new AccountModel({
42 name, 41 name,
43 url, 42 url,
44 publicKey: null, 43 publicKey: null,