1
0
Fork 0

Don't follow ourselves

This commit is contained in:
Chocobozzz 2018-02-23 14:48:30 +01:00
parent ab998f7b6d
commit 1ee48d1903
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -106,6 +106,10 @@ async function followRetry (req: express.Request, res: express.Response, next: e
}
function follow (fromActor: ActorModel, targetActor: ActorModel) {
if (fromActor.id === targetActor.id) {
throw new Error('Follower is the same than target actor.')
}
return sequelizeTypescript.transaction(async t => {
const [ actorFollow ] = await ActorFollowModel.findOrCreate({
where: {