diff options
Diffstat (limited to 'server/models/video/video-abuse.ts')
-rw-r--r-- | server/models/video/video-abuse.ts | 15 |
1 files changed, 10 insertions, 5 deletions
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 { | |||
90 | }) | 90 | }) |
91 | } | 91 | } |
92 | 92 | ||
93 | if (options.is) { | 93 | let onlyBlacklisted = false |
94 | if (options.is === "deleted") { | ||
94 | where = Object.assign(where, { | 95 | where = Object.assign(where, { |
95 | ...options.is | 96 | deletedVideo: { [Op.not]: null } |
96 | }) | 97 | }) |
98 | } else if (options.is === "blacklisted") { | ||
99 | onlyBlacklisted = true | ||
97 | } | 100 | } |
98 | 101 | ||
99 | return { | 102 | return { |
@@ -184,7 +187,7 @@ export enum ScopeNames { | |||
184 | }, | 187 | }, |
185 | { | 188 | { |
186 | model: VideoModel, | 189 | model: VideoModel, |
187 | required: false, | 190 | required: onlyBlacklisted, |
188 | where: searchAttribute(options.searchVideo, 'name'), | 191 | where: searchAttribute(options.searchVideo, 'name'), |
189 | include: [ | 192 | include: [ |
190 | { | 193 | { |
@@ -202,7 +205,8 @@ export enum ScopeNames { | |||
202 | }, | 205 | }, |
203 | { | 206 | { |
204 | attributes: [ 'id', 'reason', 'unfederated' ], | 207 | attributes: [ 'id', 'reason', 'unfederated' ], |
205 | model: VideoBlacklistModel | 208 | model: VideoBlacklistModel, |
209 | required: onlyBlacklisted | ||
206 | } | 210 | } |
207 | ] | 211 | ] |
208 | } | 212 | } |
@@ -328,7 +332,8 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> { | |||
328 | is: { | 332 | is: { |
329 | prefix: 'is:', | 333 | prefix: 'is:', |
330 | handler: v => { | 334 | handler: v => { |
331 | if (v === "deleted") return { deletedVideo: { [Op.not]: null } } | 335 | if (v === "deleted") return v |
336 | if (v === "blacklisted") return v | ||
332 | return undefined | 337 | return undefined |
333 | } | 338 | } |
334 | }, | 339 | }, |