From 6b9c966f6428c9e47bead3410a0401e8ebd744bf Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 6 Aug 2019 17:19:53 +0200 Subject: Automatically remove bad followings --- server/models/account/account-video-rate.ts | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'server/models/account/account-video-rate.ts') diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.ts index d5c214ecb..4bd8114cf 100644 --- a/server/models/account/account-video-rate.ts +++ b/server/models/account/account-video-rate.ts @@ -6,7 +6,7 @@ import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers/constan import { VideoModel } from '../video/video' import { AccountModel } from './account' import { ActorModel } from '../activitypub/actor' -import { getSort, throwIfNotValid } from '../utils' +import { buildLocalAccountIdsIn, getSort, throwIfNotValid } from '../utils' import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { AccountVideoRate } from '../../../shared' import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from '../video/video-channel' @@ -219,25 +219,11 @@ export class AccountVideoRateModel extends Model { [Op.lt]: beforeUpdatedAt }, videoId, - type - }, - include: [ - { - model: AccountModel.unscoped(), - required: true, - include: [ - { - model: ActorModel.unscoped(), - required: true, - where: { - serverId: { - [Op.ne]: null - } - } - } - ] + type, + accountId: { + [Op.notIn]: buildLocalAccountIdsIn() } - ], + }, transaction: t } -- cgit v1.2.3