Fix broken follow notification
This commit is contained in:
parent
075942b212
commit
44b88f180b
|
@ -148,6 +148,7 @@ export class UserNotification implements UserNotificationServer {
|
|||
break
|
||||
}
|
||||
} catch (err) {
|
||||
this.type = null
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import { CONSTRAINTS_FIELDS, WEBSERVER } from '../../initializers/constants'
|
|||
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'
|
||||
|
@ -220,6 +221,7 @@ export class AccountModel extends Model<AccountModel> {
|
|||
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)
|
||||
}
|
||||
|
|
|
@ -113,6 +113,24 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
|
|||
])
|
||||
}
|
||||
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue