From 327b331889861a031500cb91f698e370f14e3153 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 6 Aug 2019 17:30:09 +0200 Subject: [PATCH] Limit maximum actor follow score --- 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 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" ' + -- 2.25.1