X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Factivitypub%2Ffollow.ts;h=c1bd667e04e1def55d048eeca0b5cf4b5aa16a5f;hb=d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb;hp=a1c95504e3d7d6af694598bc5b8c8b306592d99a;hpb=4c1def5fd8e9f483238eb38e221f555e2e6bbf07;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/activitypub/follow.ts b/server/lib/activitypub/follow.ts index a1c95504e..c1bd667e0 100644 --- a/server/lib/activitypub/follow.ts +++ b/server/lib/activitypub/follow.ts @@ -1,12 +1,13 @@ -import { MActorFollowActors } from '../../typings/models' +import { Transaction } from 'sequelize' +import { getServerActor } from '@server/models/application/application' +import { logger } from '../../helpers/logger' import { CONFIG } from '../../initializers/config' import { SERVER_ACTOR_NAME } from '../../initializers/constants' -import { JobQueue } from '../job-queue' -import { logger } from '../../helpers/logger' -import { getServerActor } from '../../helpers/utils' import { ServerModel } from '../../models/server/server' +import { MActorFollowActors } from '../../types/models' +import { JobQueue } from '../job-queue' -async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors) { +async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors, transaction?: Transaction) { if (!CONFIG.FOLLOWINGS.INSTANCE.AUTO_FOLLOW_BACK.ENABLED) return const follower = actorFollow.ActorFollower @@ -16,7 +17,7 @@ async function autoFollowBackIfNeeded (actorFollow: MActorFollowActors) { const me = await getServerActor() - const server = await ServerModel.load(follower.serverId) + const server = await ServerModel.load(follower.serverId, transaction) const host = server.host const payload = {