aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorkimsible <kimsible@users.noreply.github.com>2020-07-29 15:49:04 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-11 08:46:35 +0200
commit3d215dc5f978b58b8a6d0154c3feae27f13f1600 (patch)
treebc91902c25d9b575fd473364f25a31bd8c9b4c08
parent4abe9c593aab52391e4cb9e3a578ed46a479934d (diff)
downloadPeerTube-3d215dc5f978b58b8a6d0154c3feae27f13f1600.tar.gz
PeerTube-3d215dc5f978b58b8a6d0154c3feae27f13f1600.tar.zst
PeerTube-3d215dc5f978b58b8a6d0154c3feae27f13f1600.zip
Add channelName to user-create server-side and models
-rw-r--r--server/controllers/api/users/index.ts6
-rw-r--r--shared/models/users/user-create.model.ts1
2 files changed, 6 insertions, 1 deletions
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts
index d339c2a1c..869f31d84 100644
--- a/server/controllers/api/users/index.ts
+++ b/server/controllers/api/users/index.ts
@@ -176,6 +176,7 @@ export {
176 176
177async function createUser (req: express.Request, res: express.Response) { 177async function createUser (req: express.Request, res: express.Response) {
178 const body: UserCreate = req.body 178 const body: UserCreate = req.body
179
179 const userToCreate = new UserModel({ 180 const userToCreate = new UserModel({
180 username: body.username, 181 username: body.username,
181 password: body.password, 182 password: body.password,
@@ -194,7 +195,10 @@ async function createUser (req: express.Request, res: express.Response) {
194 userToCreate.password = await generateRandomString(20) 195 userToCreate.password = await generateRandomString(20)
195 } 196 }
196 197
197 const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({ userToCreate: userToCreate }) 198 const { user, account, videoChannel } = await createUserAccountAndChannelAndPlaylist({
199 userToCreate,
200 channelNames: { name: body.channelName, displayName: body.channelName }
201 })
198 202
199 auditLogger.create(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON())) 203 auditLogger.create(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON()))
200 logger.info('User %s with its channel and account created.', body.username) 204 logger.info('User %s with its channel and account created.', body.username)
diff --git a/shared/models/users/user-create.model.ts b/shared/models/users/user-create.model.ts
index 6677b42aa..601c531cd 100644
--- a/shared/models/users/user-create.model.ts
+++ b/shared/models/users/user-create.model.ts
@@ -9,4 +9,5 @@ export interface UserCreate {
9 videoQuotaDaily: number 9 videoQuotaDaily: number
10 role: UserRole 10 role: UserRole
11 adminFlags?: UserAdminFlag 11 adminFlags?: UserAdminFlag
12 channelName: string
12} 13}