From: Chocobozzz Date: Fri, 23 Feb 2018 13:48:30 +0000 (+0100) Subject: Don't follow ourselves X-Git-Tag: v0.0.27-alpha~6 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1ee48d19036199169eca061f1ecccd2f2c8fd359;p=oweals%2Fpeertube.git Don't follow ourselves --- diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts index bb8713e7a..4a0a44cd3 100644 --- a/server/controllers/api/server/follows.ts +++ b/server/controllers/api/server/follows.ts @@ -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: {