aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/activitypub
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/activitypub')
-rw-r--r--server/models/activitypub/actor-follow.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts
index b8ce6de1d..adec5e92b 100644
--- a/server/models/activitypub/actor-follow.ts
+++ b/server/models/activitypub/actor-follow.ts
@@ -111,7 +111,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
111 if (numberOfActorFollowsRemoved) logger.info('Removed bad %d actor follows.', numberOfActorFollowsRemoved) 111 if (numberOfActorFollowsRemoved) logger.info('Removed bad %d actor follows.', numberOfActorFollowsRemoved)
112 } 112 }
113 113
114 static updateActorFollowsScore (goodInboxes: string[], badInboxes: string[], t: Sequelize.Transaction) { 114 static updateActorFollowsScore (goodInboxes: string[], badInboxes: string[], t: Sequelize.Transaction | undefined) {
115 if (goodInboxes.length === 0 && badInboxes.length === 0) return 115 if (goodInboxes.length === 0 && badInboxes.length === 0) return
116 116
117 logger.info('Updating %d good actor follows and %d bad actor follows scores.', goodInboxes.length, badInboxes.length) 117 logger.info('Updating %d good actor follows and %d bad actor follows scores.', goodInboxes.length, badInboxes.length)
@@ -344,7 +344,7 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
344 } 344 }
345 } 345 }
346 346
347 private static incrementScores (inboxUrls: string[], value: number, t: Sequelize.Transaction) { 347 private static incrementScores (inboxUrls: string[], value: number, t: Sequelize.Transaction | undefined) {
348 const inboxUrlsString = inboxUrls.map(url => `'${url}'`).join(',') 348 const inboxUrlsString = inboxUrls.map(url => `'${url}'`).join(',')
349 349
350 const query = `UPDATE "actorFollow" SET "score" = LEAST("score" + ${value}, ${ACTOR_FOLLOW_SCORE.MAX}) ` + 350 const query = `UPDATE "actorFollow" SET "score" = LEAST("score" + ${value}, ${ACTOR_FOLLOW_SCORE.MAX}) ` +
@@ -354,10 +354,10 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
354 'WHERE "actor"."inboxUrl" IN (' + inboxUrlsString + ') OR "actor"."sharedInboxUrl" IN (' + inboxUrlsString + ')' + 354 'WHERE "actor"."inboxUrl" IN (' + inboxUrlsString + ') OR "actor"."sharedInboxUrl" IN (' + inboxUrlsString + ')' +
355 ')' 355 ')'
356 356
357 const options = { 357 const options = t ? {
358 type: Sequelize.QueryTypes.BULKUPDATE, 358 type: Sequelize.QueryTypes.BULKUPDATE,
359 transaction: t 359 transaction: t
360 } 360 } : undefined
361 361
362 return ActorFollowModel.sequelize.query(query, options) 362 return ActorFollowModel.sequelize.query(query, options)
363 } 363 }