From: Chocobozzz Date: Thu, 11 Jan 2018 17:35:39 +0000 (+0100) Subject: Add maximum to actor follow scores X-Git-Tag: v0.0.1-alpha~17 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=05bc4dfa069be5273765a68652598d72dbf482fb;p=oweals%2Fpeertube.git Add maximum to actor follow scores --- 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" ' +