X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fuser.ts;h=8b447583e12c4cabc8a51af69ac2d9ddcbaa491d;hb=212e17a1892162a69138c0b9c0a1bd88f95209a8;hp=d84aff464b268684bb63620d13292c2ac1963fa9;hpb=5c5e587307a27e173333789b5b5167d35f468b01;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/user.ts b/server/lib/user.ts index d84aff464..8b447583e 100644 --- a/server/lib/user.ts +++ b/server/lib/user.ts @@ -1,8 +1,8 @@ -import * as uuidv4 from 'uuid/v4' +import { v4 as uuidv4 } from 'uuid' import { ActivityPubActorType } from '../../shared/models/activitypub' import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants' import { AccountModel } from '../models/account/account' -import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub' +import { buildActorInstance, setAsyncActorKeys } from './activitypub/actor' import { createLocalVideoChannel } from './video-channel' import { ActorModel } from '../models/activitypub/actor' import { UserNotificationSettingModel } from '../models/account/user-notification-setting' @@ -14,13 +14,14 @@ import { Redis } from './redis' import { Emailer } from './emailer' import { MAccountDefault, MActorDefault, MChannelActor } from '../typings/models' import { MUser, MUserDefault, MUserId } from '../typings/models/user' +import { getAccountActivityPubUrl } from './activitypub/url' type ChannelNames = { name: string, displayName: string } async function createUserAccountAndChannelAndPlaylist (parameters: { - userToCreate: MUser, - userDisplayName?: string, - channelNames?: ChannelNames, + userToCreate: MUser + userDisplayName?: string + channelNames?: ChannelNames validateUser?: boolean }): Promise<{ user: MUserDefault, account: MAccountDefault, videoChannel: MChannelActor }> { const { userToCreate, userDisplayName, channelNames, validateUser = true } = parameters @@ -63,11 +64,11 @@ async function createUserAccountAndChannelAndPlaylist (parameters: { } async function createLocalAccountWithoutKeys (parameters: { - name: string, - displayName?: string, - userId: number | null, - applicationId: number | null, - t: Transaction | undefined, + name: string + displayName?: string + userId: number | null + applicationId: number | null + t: Transaction | undefined type?: ActivityPubActorType }) { const { name, displayName, userId, applicationId, t, type = 'Person' } = parameters @@ -138,7 +139,8 @@ function createDefaultUserNotificationSettings (user: MUserId, t: Transaction | newUserRegistration: UserNotificationSettingValue.WEB, commentMention: UserNotificationSettingValue.WEB, newFollow: UserNotificationSettingValue.WEB, - newInstanceFollower: UserNotificationSettingValue.WEB + newInstanceFollower: UserNotificationSettingValue.WEB, + autoInstanceFollowing: UserNotificationSettingValue.WEB } return UserNotificationSettingModel.create(values, { transaction: t })