projects
/
oweals
/
peertube.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ab998f7
)
Don't follow ourselves
author
Chocobozzz
<me@florianbigard.com>
Fri, 23 Feb 2018 13:48:30 +0000
(14:48 +0100)
committer
Chocobozzz
<me@florianbigard.com>
Fri, 23 Feb 2018 13:48:30 +0000
(14:48 +0100)
server/controllers/api/server/follows.ts
patch
|
blob
|
history
diff --git
a/server/controllers/api/server/follows.ts
b/server/controllers/api/server/follows.ts
index bb8713e7a00a8903abcac4d0dd02bd6d461a29bb..4a0a44cd395f7959e0ec8433f5dffa8c107034b4 100644
(file)
--- 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: {