1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

expliciting type checks and predicates (server only)

This commit is contained in:
Rigel Kent 2018-07-25 22:01:25 +02:00
parent 5f7021c33d
commit c1e791bad0
No known key found for this signature in database
GPG key ID: EA12971B0E438F36
34 changed files with 127 additions and 84 deletions

View file

@ -6,6 +6,7 @@ import { UserModel } from '../models/account/user'
import { buildActorInstance, getAccountActivityPubUrl, setAsyncActorKeys } from './activitypub'
import { createVideoChannel } from './video-channel'
import { VideoChannelModel } from '../models/video/video-channel'
import { FilteredModelAttributes } from 'sequelize-typescript/lib/models/Model'
async function createUserAccountAndChannel (userToCreate: UserModel, validateUser = true) {
const { user, account, videoChannel } = await sequelizeTypescript.transaction(async t => {
@ -34,9 +35,9 @@ async function createUserAccountAndChannel (userToCreate: UserModel, validateUse
async function createLocalAccountWithoutKeys (
name: string,
userId: number,
applicationId: number,
t: Sequelize.Transaction,
userId: number | null,
applicationId: number | null,
t: Sequelize.Transaction | undefined,
type: ActivityPubActorType= 'Person'
) {
const url = getAccountActivityPubUrl(name)
@ -49,7 +50,7 @@ async function createLocalAccountWithoutKeys (
userId,
applicationId,
actorId: actorInstanceCreated.id
})
} as FilteredModelAttributes<AccountModel>)
const accountInstanceCreated = await accountInstance.save({ transaction: t })
accountInstanceCreated.Actor = actorInstanceCreated