diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-07-25 22:01:25 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-07-25 22:01:25 +0200 |
commit | c1e791bad0b079af67398f6407221e6dcbb573dd (patch) | |
tree | 82e5944b4458dd35aa482a38f6b650eb93bb89ad /server/lib/user.ts | |
parent | 5f7021c33d31c5255b995ae0ff86b5bbea4ea4b9 (diff) | |
download | PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.gz PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.tar.zst PeerTube-c1e791bad0b079af67398f6407221e6dcbb573dd.zip |
expliciting type checks and predicates (server only)
Diffstat (limited to 'server/lib/user.ts')
-rw-r--r-- | server/lib/user.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/lib/user.ts b/server/lib/user.ts index 51050de9b..ac5f55260 100644 --- a/server/lib/user.ts +++ b/server/lib/user.ts | |||
@@ -6,6 +6,7 @@ import { UserModel } from '../models/account/user' | |||
6 | import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub' | 6 | import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub' |
7 | import { createVideoChannel } from './video-channel' | 7 | import { createVideoChannel } from './video-channel' |
8 | import { VideoChannelModel } from '../models/video/video-channel' | 8 | import { VideoChannelModel } from '../models/video/video-channel' |
9 | import { FilteredModelAttributes } from 'sequelize-typescript/lib/models/Model' | ||
9 | 10 | ||
10 | async function createUserAccountAndChannel (userToCreate: UserModel, validateUser = true) { | 11 | async function createUserAccountAndChannel (userToCreate: UserModel, validateUser = true) { |
11 | const { user, account, videoChannel } = await sequelizeTypescript.transaction(async t => { | 12 | const { user, account, videoChannel } = await sequelizeTypescript.transaction(async t => { |
@@ -34,9 +35,9 @@ async function createUserAccountAndChannel (userToCreate: UserModel, validateUse | |||
34 | 35 | ||
35 | async function createLocalAccountWithoutKeys ( | 36 | async function createLocalAccountWithoutKeys ( |
36 | name: string, | 37 | name: string, |
37 | userId: number, | 38 | userId: number | null, |
38 | applicationId: number, | 39 | applicationId: number | null, |
39 | t: Sequelize.Transaction, | 40 | t: Sequelize.Transaction | undefined, |
40 | type: ActivityPubActorType= 'Person' | 41 | type: ActivityPubActorType= 'Person' |
41 | ) { | 42 | ) { |
42 | const url = getAccountActivityPubUrl(name) | 43 | const url = getAccountActivityPubUrl(name) |
@@ -49,7 +50,7 @@ async function createLocalAccountWithoutKeys ( | |||
49 | userId, | 50 | userId, |
50 | applicationId, | 51 | applicationId, |
51 | actorId: actorInstanceCreated.id | 52 | actorId: actorInstanceCreated.id |
52 | }) | 53 | } as FilteredModelAttributes<AccountModel>) |
53 | 54 | ||
54 | const accountInstanceCreated = await accountInstance.save({ transaction: t }) | 55 | const accountInstanceCreated = await accountInstance.save({ transaction: t }) |
55 | accountInstanceCreated.Actor = actorInstanceCreated | 56 | accountInstanceCreated.Actor = actorInstanceCreated |