From 9b1fa49b6032c149d8a848da086f60e52bd4b82a Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sun, 3 May 2020 16:16:10 +0200 Subject: Support is:blacklisted as video-abuse-list filter --- server/models/video/video-abuse.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'server/models/video') diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts index b1f8fed90..f6b546825 100644 --- a/server/models/video/video-abuse.ts +++ b/server/models/video/video-abuse.ts @@ -90,10 +90,13 @@ export enum ScopeNames { }) } - if (options.is) { + let onlyBlacklisted = false + if (options.is === "deleted") { where = Object.assign(where, { - ...options.is + deletedVideo: { [Op.not]: null } }) + } else if (options.is === "blacklisted") { + onlyBlacklisted = true } return { @@ -184,7 +187,7 @@ export enum ScopeNames { }, { model: VideoModel, - required: false, + required: onlyBlacklisted, where: searchAttribute(options.searchVideo, 'name'), include: [ { @@ -202,7 +205,8 @@ export enum ScopeNames { }, { attributes: [ 'id', 'reason', 'unfederated' ], - model: VideoBlacklistModel + model: VideoBlacklistModel, + required: onlyBlacklisted } ] } @@ -328,7 +332,8 @@ export class VideoAbuseModel extends Model { is: { prefix: 'is:', handler: v => { - if (v === "deleted") return { deletedVideo: { [Op.not]: null } } + if (v === "deleted") return v + if (v === "blacklisted") return v return undefined } }, -- cgit v1.2.3