X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Factivitypub%2Factor-follow.ts;h=20d3aa5fcbaa7364ac344c0503fc4f6dac01ed62;hb=99492dbc0d87ef54d0dab7d8d44f8d0de5722bdd;hp=90a8ac43c6d3f1c2904887b9498b32a89c94d43a;hpb=8a19bee1a1ee39f973bb37429e4f73c3f2873cdb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts index 90a8ac43c..20d3aa5fc 100644 --- a/server/models/activitypub/actor-follow.ts +++ b/server/models/activitypub/actor-follow.ts @@ -28,6 +28,7 @@ import { ServerModel } from '../server/server' import { getSort } from '../utils' import { ActorModel } from './actor' import { VideoChannelModel } from '../video/video-channel' +import { IIncludeOptions } from '../../../node_modules/sequelize-typescript/lib/interfaces/IIncludeOptions' @Table({ tableName: 'actorFollow', @@ -166,28 +167,30 @@ export class ActorFollowModel extends Model { } static loadByActorAndTargetNameAndHost (actorId: number, targetName: string, targetHost: string, t?: Sequelize.Transaction) { - const actorFollowingPartInclude = { + const actorFollowingPartInclude: IIncludeOptions = { model: ActorModel, required: true, as: 'ActorFollowing', where: { preferredUsername: targetName - } + }, + include: [ + { + model: VideoChannelModel, + required: false + } + ] } if (targetHost === null) { actorFollowingPartInclude.where['serverId'] = null } else { - Object.assign(actorFollowingPartInclude, { - include: [ - { - model: ServerModel, - required: true, - where: { - host: targetHost - } - } - ] + actorFollowingPartInclude.include.push({ + model: ServerModel, + required: true, + where: { + host: targetHost + } }) }