X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Faccount%2Faccount.ts;h=27c75d8861203c3be8c6e8e27b9d134e3dbb334c;hb=e724fa93c71d76d709e819a05e5e2904a3c4205b;hp=66f5dcf2ef3d22d269769bc008cde0a782a1a4e5;hpb=9a12f169c15b638fe78cf6e85a1993550a25e404;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 66f5dcf2e..27c75d886 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -19,7 +19,6 @@ import { isAccountDescriptionValid } from '../../helpers/custom-validators/accou import { sendDeleteActor } from '../../lib/activitypub/send' import { ActorModel } from '../activitypub/actor' import { ApplicationModel } from '../application/application' -import { AvatarModel } from '../avatar/avatar' import { ServerModel } from '../server/server' import { getSort, throwIfNotValid } from '../utils' import { VideoChannelModel } from '../video/video-channel' @@ -29,18 +28,8 @@ import { UserModel } from './user' @DefaultScope({ include: [ { - model: () => ActorModel, - required: true, - include: [ - { - model: () => ServerModel, - required: false - }, - { - model: () => AvatarModel, - required: false - } - ] + model: () => ActorModel, // Default scope includes avatar and server + required: true } ] }) @@ -144,8 +133,8 @@ export class AccountModel extends Model { return undefined } - static load (id: number) { - return AccountModel.findById(id) + static load (id: number, transaction?: Sequelize.Transaction) { + return AccountModel.findById(id, { transaction }) } static loadByUUID (uuid: string) { @@ -194,7 +183,7 @@ export class AccountModel extends Model { return AccountModel.findOne(query) } - static loadLocalByNameAndHost (name: string, host: string) { + static loadByNameAndHost (name: string, host: string) { const query = { include: [ {