1
0
Fork 0

Limit maximum actor follow score

This commit is contained in:
Chocobozzz 2019-08-06 17:30:09 +02:00
parent b3d1054e86
commit 327b331889
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -486,7 +486,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
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" ' +