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.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/lib/user.ts b/server/lib/user.ts
index ec1466c6f..aa029cce7 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -6,15 +6,15 @@ import { UserModel } from '../models/account/user'
6import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub' 6import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub'
7import { createVideoChannel } from './video-channel' 7import { createVideoChannel } from './video-channel'
8 8
9async function createUserAccountAndChannel (user: UserModel, validateUser = true) { 9async function createUserAccountAndChannel (userToCreate: UserModel, validateUser = true) {
10 const { account, videoChannel } = await sequelizeTypescript.transaction(async t => { 10 const { user, account, videoChannel } = await sequelizeTypescript.transaction(async t => {
11 const userOptions = { 11 const userOptions = {
12 transaction: t, 12 transaction: t,
13 validate: validateUser 13 validate: validateUser
14 } 14 }
15 15
16 const userCreated = await user.save(userOptions) 16 const userCreated = await userToCreate.save(userOptions)
17 const accountCreated = await createLocalAccountWithoutKeys(user.username, user.id, null, t) 17 const accountCreated = await createLocalAccountWithoutKeys(userToCreate.username, userToCreate.id, null, t)
18 18
19 const videoChannelName = `Default ${userCreated.username} channel` 19 const videoChannelName = `Default ${userCreated.username} channel`
20 const videoChannelInfo = { 20 const videoChannelInfo = {
@@ -22,13 +22,13 @@ async function createUserAccountAndChannel (user: UserModel, validateUser = true
22 } 22 }
23 const videoChannel = await createVideoChannel(videoChannelInfo, accountCreated, t) 23 const videoChannel = await createVideoChannel(videoChannelInfo, accountCreated, t)
24 24
25 return { account: accountCreated, videoChannel } 25 return { user: userCreated, account: accountCreated, videoChannel }
26 }) 26 })
27 27
28 account.Actor = await setAsyncActorKeys(account.Actor) 28 account.Actor = await setAsyncActorKeys(account.Actor)
29 videoChannel.Actor = await setAsyncActorKeys(videoChannel.Actor) 29 videoChannel.Actor = await setAsyncActorKeys(videoChannel.Actor)
30 30
31 return { account, videoChannel } 31 return { user, account, videoChannel }
32} 32}
33 33
34async function createLocalAccountWithoutKeys ( 34async function createLocalAccountWithoutKeys (