Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add maximum to actor follow scores

Chocobozzz05bc4dfa069b
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts
index 78a65a0ff5..920c83d885 100644
--- 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" ' +