From 05bc4dfa069be5273765a68652598d72dbf482fb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Jan 2018 18:35:39 +0100 Subject: [PATCH] Add maximum to actor follow scores --- server/models/activitypub/actor-follow.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts index 78a65a0ff..920c83d88 100644 --- a/server/models/activitypub/actor-follow.ts +++ b/server/models/activitypub/actor-follow.ts @@ -307,7 +307,7 @@ export class ActorFollowModel extends Model { 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" ' + -- 2.25.1