diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-23 14:48:30 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-23 14:48:30 +0100 |
commit | 1ee48d19036199169eca061f1ecccd2f2c8fd359 (patch) | |
tree | 30fdf740665e6480129c1b9c917f65dfb373806c /server/controllers/api | |
parent | ab998f7b6dffbe461d830d3696cb46491ad6afb0 (diff) | |
download | PeerTube-1ee48d19036199169eca061f1ecccd2f2c8fd359.tar.gz PeerTube-1ee48d19036199169eca061f1ecccd2f2c8fd359.tar.zst PeerTube-1ee48d19036199169eca061f1ecccd2f2c8fd359.zip |
Don't follow ourselves
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/server/follows.ts | 4 |
1 files changed, 4 insertions, 0 deletions
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 | |||
106 | } | 106 | } |
107 | 107 | ||
108 | function follow (fromActor: ActorModel, targetActor: ActorModel) { | 108 | function follow (fromActor: ActorModel, targetActor: ActorModel) { |
109 | if (fromActor.id === targetActor.id) { | ||
110 | throw new Error('Follower is the same than target actor.') | ||
111 | } | ||
112 | |||
109 | return sequelizeTypescript.transaction(async t => { | 113 | return sequelizeTypescript.transaction(async t => { |
110 | const [ actorFollow ] = await ActorFollowModel.findOrCreate({ | 114 | const [ actorFollow ] = await ActorFollowModel.findOrCreate({ |
111 | where: { | 115 | where: { |