import { FindOptions, IncludeOptions, Op, Transaction, WhereOptions } from 'sequelize'
import { AccountBlocklistModel } from './account-blocklist'
import { ServerBlocklistModel } from '../server/server-blocklist'
+import { ActorFollowModel } from '../activitypub/actor-follow'
export enum ScopeNames {
SUMMARY = 'SUMMARY'
instance.Actor = await instance.$get('Actor', { transaction: options.transaction }) as ActorModel
}
+ await ActorFollowModel.removeFollowsOf(instance.Actor.id, options.transaction)
if (instance.isOwned()) {
return sendDeleteActor(instance.Actor, options.transaction)
}
])
}
+ static removeFollowsOf (actorId: number, t?: Transaction) {
+ const query = {
+ where: {
+ [Op.or]: [
+ {
+ actorId
+ },
+ {
+ targetActorId: actorId
+ }
+ ]
+ },
+ transaction: t
+ }
+
+ return ActorFollowModel.destroy(query)
+ }
+
// Remove actor follows with a score of 0 (too many requests where they were unreachable)
static async removeBadActorFollows () {
const actorFollows = await ActorFollowModel.listBadActorFollows()