]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add channelName to user-create server-side and models
authorkimsible <kimsible@users.noreply.github.com>
Wed, 29 Jul 2020 13:49:04 +0000 (15:49 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Tue, 11 Aug 2020 06:46:35 +0000 (08:46 +0200)
server/controllers/api/users/index.ts
shared/models/users/user-create.model.ts

index d339c2a1c0abf498c36d48b5bdf60f265471c477..869f31d848ce739175d5288d3a02d1aaa52fabd0 100644 (file)
@@ -176,6 +176,7 @@ export {
 
 async function createUser (req: express.Request, res: express.Response) {
   const body: UserCreate = req.body
+
   const userToCreate = new UserModel({
     username: body.username,
     password: body.password,
@@ -194,7 +195,10 @@ async function createUser (req: express.Request, res: express.Response) {
     userToCreate.password = await generateRandomString(20)
   }
 
-  const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({ userToCreate: userToCreate })
+  const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({
+    userToCreate,
+    channelNames: { name: body.channelName, displayName: body.channelName }
+  })
 
   auditLogger.create(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON()))
   logger.info('User %s with its channel and account created.', body.username)
index 6677b42aa244c044d5dc53df5d7f307089790332..601c531cd1cfe2d99c9637c2902a1d203b6ae781 100644 (file)
@@ -9,4 +9,5 @@ export interface UserCreate {
   videoQuotaDaily: number
   role: UserRole
   adminFlags?: UserAdminFlag
+  channelName: string
 }