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/video/video-share.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'server/models/video/video-share.ts') diff --git a/server/models/video/video-share.ts b/server/models/video/video-share.ts index 3bab3c027..d8ed64557 100644 --- a/server/models/video/video-share.ts +++ b/server/models/video/video-share.ts @@ -4,7 +4,7 @@ import { isActivityPubUrlValid } from '../../helpers/custom-validators/activityp import { CONSTRAINTS_FIELDS } from '../../initializers/constants' import { AccountModel } from '../account/account' import { ActorModel } from '../activitypub/actor' -import { throwIfNotValid } from '../utils' +import { buildLocalActorIdsIn, throwIfNotValid } from '../utils' import { VideoModel } from './video' import { VideoChannelModel } from './video-channel' import { Op, Transaction } from 'sequelize' @@ -207,19 +207,11 @@ export class VideoShareModel extends Model { updatedAt: { [Op.lt]: beforeUpdatedAt }, - videoId - }, - include: [ - { - model: ActorModel.unscoped(), - required: true, - where: { - serverId: { - [ Op.ne ]: null - } - } + videoId, + actorId: { + [Op.notIn]: buildLocalActorIdsIn() } - ] + } } return VideoShareModel.destroy(query) -- cgit v1.2.3