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.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/server/lib/user.ts b/server/lib/user.ts
index db29469eb..acb883e23 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -17,8 +17,10 @@ async function createUserAccountAndChannel (userToCreate: UserModel, validateUse
17 validate: validateUser 17 validate: validateUser
18 } 18 }
19 19
20 const userCreated = await userToCreate.save(userOptions) 20 const [ userCreated, accountCreated ] = await Promise.all([
21 const accountCreated = await createLocalAccountWithoutKeys(userToCreate.username, userToCreate.id, null, t) 21 userToCreate.save(userOptions),
22 createLocalAccountWithoutKeys(userToCreate.username, userToCreate.id, null, t)
23 ])
22 userCreated.Account = accountCreated 24 userCreated.Account = accountCreated
23 25
24 let channelName = userCreated.username + '_channel' 26 let channelName = userCreated.username + '_channel'
@@ -37,8 +39,13 @@ async function createUserAccountAndChannel (userToCreate: UserModel, validateUse
37 return { user: userCreated, account: accountCreated, videoChannel } 39 return { user: userCreated, account: accountCreated, videoChannel }
38 }) 40 })
39 41
40 account.Actor = await setAsyncActorKeys(account.Actor) 42 const [ accountKeys, channelKeys ] = await Promise.all([
41 videoChannel.Actor = await setAsyncActorKeys(videoChannel.Actor) 43 setAsyncActorKeys(account.Actor),
44 setAsyncActorKeys(videoChannel.Actor)
45 ])
46
47 account.Actor = accountKeys
48 videoChannel.Actor = channelKeys
42 49
43 return { user, account, videoChannel } as { user: UserModel, account: AccountModel, videoChannel: VideoChannelModel } 50 return { user, account, videoChannel } as { user: UserModel, account: AccountModel, videoChannel: VideoChannelModel }
44} 51}