aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/server/follows.ts4
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
108function follow (fromActor: ActorModel, targetActor: ActorModel) { 108function 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: {