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:
4bbc373
)
Add maximum to actor follow scores
author
Chocobozzz
<me@florianbigard.com>
Thu, 11 Jan 2018 17:35:39 +0000
(18:35 +0100)
committer
Chocobozzz
<me@florianbigard.com>
Thu, 11 Jan 2018 17:35:39 +0000
(18:35 +0100)
server/models/activitypub/actor-follow.ts
patch
|
blob
|
history
diff --git
a/server/models/activitypub/actor-follow.ts
b/server/models/activitypub/actor-follow.ts
index 78a65a0ff58cdaf8f937e08993cfd1c6510ad935..920c83d885bc957fa55f40affc970e59746f995b 100644
(file)
--- a/
server/models/activitypub/actor-follow.ts
+++ b/
server/models/activitypub/actor-follow.ts
@@
-307,7
+307,7
@@
export class ActorFollowModel extends Model<ActorFollowModel> {
private static incrementScores (inboxUrls: string[], value: number, t: Sequelize.Transaction) {
const inboxUrlsString = inboxUrls.map(url => `'${url}'`).join(',')
- const query =
'UPDATE "actorFollow" SET "score" = "score" +' + value + ' '
+
+ const query =
`UPDATE "actorFollow" SET "score" = LEAST("score" + ${value}, ${ACTOR_FOLLOW_SCORE.MAX}) `
+
'WHERE id IN (' +
'SELECT "actorFollow"."id" FROM "actorFollow" ' +
'INNER JOIN "actor" ON "actor"."id" = "actorFollow"."actorId" ' +