aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/user.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-09 17:51:58 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commite4f97babf701481b55cc10fb3448feab5f97c867 (patch)
treeaf37402a594dc5ff09f71ecb0687e8cfe4cdb471 /server/lib/user.ts
parent343ad675f2a26c15b86150a9a3552e619d5d44f4 (diff)
downloadPeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.tar.gz
PeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.tar.zst
PeerTube-e4f97babf701481b55cc10fb3448feab5f97c867.zip
Begin activitypub
Diffstat (limited to 'server/lib/user.ts')
-rw-r--r--server/lib/user.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/lib/user.ts b/server/lib/user.ts
index a92f4777b..57c653e55 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -1,9 +1,9 @@
1import { database as db } from '../initializers' 1import { database as db } from '../initializers'
2import { UserInstance } from '../models' 2import { UserInstance } from '../models'
3import { addVideoAuthorToFriends } from './friends' 3import { addVideoAccountToFriends } from './friends'
4import { createVideoChannel } from './video-channel' 4import { createVideoChannel } from './video-channel'
5 5
6async function createUserAuthorAndChannel (user: UserInstance, validateUser = true) { 6async function createUserAccountAndChannel (user: UserInstance, validateUser = true) {
7 const res = await db.sequelize.transaction(async t => { 7 const res = await db.sequelize.transaction(async t => {
8 const userOptions = { 8 const userOptions = {
9 transaction: t, 9 transaction: t,
@@ -11,25 +11,25 @@ async function createUserAuthorAndChannel (user: UserInstance, validateUser = tr
11 } 11 }
12 12
13 const userCreated = await user.save(userOptions) 13 const userCreated = await user.save(userOptions)
14 const authorInstance = db.Author.build({ 14 const accountInstance = db.Account.build({
15 name: userCreated.username, 15 name: userCreated.username,
16 podId: null, // It is our pod 16 podId: null, // It is our pod
17 userId: userCreated.id 17 userId: userCreated.id
18 }) 18 })
19 19
20 const authorCreated = await authorInstance.save({ transaction: t }) 20 const accountCreated = await accountInstance.save({ transaction: t })
21 21
22 const remoteVideoAuthor = authorCreated.toAddRemoteJSON() 22 const remoteVideoAccount = accountCreated.toAddRemoteJSON()
23 23
24 // Now we'll add the video channel's meta data to our friends 24 // Now we'll add the video channel's meta data to our friends
25 const author = await addVideoAuthorToFriends(remoteVideoAuthor, t) 25 const account = await addVideoAccountToFriends(remoteVideoAccount, t)
26 26
27 const videoChannelInfo = { 27 const videoChannelInfo = {
28 name: `Default ${userCreated.username} channel` 28 name: `Default ${userCreated.username} channel`
29 } 29 }
30 const videoChannel = await createVideoChannel(videoChannelInfo, authorCreated, t) 30 const videoChannel = await createVideoChannel(videoChannelInfo, accountCreated, t)
31 31
32 return { author, videoChannel } 32 return { account, videoChannel }
33 }) 33 })
34 34
35 return res 35 return res
@@ -38,5 +38,5 @@ async function createUserAuthorAndChannel (user: UserInstance, validateUser = tr
38// --------------------------------------------------------------------------- 38// ---------------------------------------------------------------------------
39 39
40export { 40export {
41 createUserAuthorAndChannel 41 createUserAccountAndChannel
42} 42}