X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fserver-commands%2Fusers%2Fusers-command.ts;h=811b9685b42c4c3293a5dfcf5b6500cd3eb3dc8f;hb=71e3e879c0616882ee82a0e44f8c2e5ee9698a3e;hp=90c5f218340aefe38c9764f41761be7a6d077ab6;hpb=bf54587a3e2ad9c2c186828f2a5682b91ee2cc00;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/server-commands/users/users-command.ts b/shared/server-commands/users/users-command.ts index 90c5f2183..811b9685b 100644 --- a/shared/server-commands/users/users-command.ts +++ b/shared/server-commands/users/users-command.ts @@ -1,9 +1,9 @@ -import { omit } from 'lodash' -import { pick } from '@shared/core-utils' +import { omit, pick } from '@shared/core-utils' import { HttpStatusCode, MyUser, ResultList, + ScopedToken, User, UserAdminFlag, UserCreateResult, @@ -13,7 +13,6 @@ import { UserVideoQuota, UserVideoRate } from '@shared/models' -import { ScopedToken } from '@shared/models/users/user-scoped-token' import { unwrapBody } from '../requests' import { AbstractCommand, OverrideCommandOptions } from '../shared' @@ -203,7 +202,8 @@ export class UsersCommand extends AbstractCommand { token, userId: user.id, userChannelId: me.videoChannels[0].id, - userChannelName: me.videoChannels[0].name + userChannelName: me.videoChannels[0].name, + password } } @@ -218,12 +218,13 @@ export class UsersCommand extends AbstractCommand { username: string password?: string displayName?: string + email?: string channel?: { name: string displayName: string } }) { - const { username, password = 'password', displayName, channel } = options + const { username, password = 'password', displayName, channel, email = username + '@example.com' } = options const path = '/api/v1/users/register' return this.postBodyRequest({ @@ -233,7 +234,7 @@ export class UsersCommand extends AbstractCommand { fields: { username, password, - email: username + '@example.com', + email, displayName, channel }, @@ -298,7 +299,7 @@ export class UsersCommand extends AbstractCommand { updateMe (options: OverrideCommandOptions & UserUpdateMe) { const path = '/api/v1/users/me' - const toSend: UserUpdateMe = omit(options, 'url', 'accessToken') + const toSend: UserUpdateMe = omit(options, [ 'expectedStatus', 'token' ]) return this.putBodyRequest({ ...options,