From: Chocobozzz Date: Tue, 6 Aug 2019 15:30:09 +0000 (+0200) Subject: Limit maximum actor follow score X-Git-Tag: v1.4.0-rc.1~21 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=327b331889861a031500cb91f698e370f14e3153;p=github%2FChocobozzz%2FPeerTube.git Limit maximum actor follow score --- diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts index 99a5fd117..51b09e09b 100644 --- a/server/models/activitypub/actor-follow.ts +++ b/server/models/activitypub/actor-follow.ts @@ -486,7 +486,7 @@ export class ActorFollowModel extends Model { const me = await getServerActor() const serverIdsString = createSafeIn(ActorFollowModel, serverIds) - 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"."targetActorId" ' +