From 9b1fa49b6032c149d8a848da086f60e52bd4b82a Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sun, 3 May 2020 16:16:10 +0200 Subject: [PATCH] Support is:blacklisted as video-abuse-list filter --- .../video-abuse-list.component.html | 2 +- server/models/video/video-abuse.ts | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html index cf5cd58f8..bf989cb4e 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.html @@ -24,7 +24,7 @@ Unsolved reports Accepted reports Refused reports - Reports with blocked videos + Reports with blacklisted videos Reports with deleted videos 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 } }, -- 2.25.1