aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-abuse.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-06 10:31:52 +0200
committerChocobozzz <me@florianbigard.com>2020-05-06 10:31:52 +0200
commitfc8aabd0bf38441c0591f21b9b435b52e99ffc23 (patch)
tree0fd22fd08d9952cd19961d9e01d1237a05eb5bfa /server/models/video/video-abuse.ts
parentd056b019565539c5d12a302d1968581a186e5514 (diff)
downloadPeerTube-fc8aabd0bf38441c0591f21b9b435b52e99ffc23.tar.gz
PeerTube-fc8aabd0bf38441c0591f21b9b435b52e99ffc23.tar.zst
PeerTube-fc8aabd0bf38441c0591f21b9b435b52e99ffc23.zip
parseQueryStringFilter cleanup
Diffstat (limited to 'server/models/video/video-abuse.ts')
-rw-r--r--server/models/video/video-abuse.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/server/models/video/video-abuse.ts b/server/models/video/video-abuse.ts
index f6b546825..6cd2c0418 100644
--- a/server/models/video/video-abuse.ts
+++ b/server/models/video/video-abuse.ts
@@ -32,10 +32,12 @@ export enum ScopeNames {
32 searchReportee?: string 32 searchReportee?: string
33 searchVideo?: string 33 searchVideo?: string
34 searchVideoChannel?: string 34 searchVideoChannel?: string
35
35 // filters 36 // filters
36 id?: number 37 id?: number
37 state?: VideoAbuseState 38 state?: VideoAbuseState
38 is?: any 39 is?: 'deleted' | 'blacklisted'
40
39 // accountIds 41 // accountIds
40 serverAccountId: number 42 serverAccountId: number
41 userAccountId: number 43 userAccountId: number
@@ -91,11 +93,11 @@ export enum ScopeNames {
91 } 93 }
92 94
93 let onlyBlacklisted = false 95 let onlyBlacklisted = false
94 if (options.is === "deleted") { 96 if (options.is === 'deleted') {
95 where = Object.assign(where, { 97 where = Object.assign(where, {
96 deletedVideo: { [Op.not]: null } 98 deletedVideo: { [Op.not]: null }
97 }) 99 })
98 } else if (options.is === "blacklisted") { 100 } else if (options.is === 'blacklisted') {
99 onlyBlacklisted = true 101 onlyBlacklisted = true
100 } 102 }
101 103
@@ -323,17 +325,17 @@ export class VideoAbuseModel extends Model<VideoAbuseModel> {
323 state: { 325 state: {
324 prefix: 'state:', 326 prefix: 'state:',
325 handler: v => { 327 handler: v => {
326 if (v === "accepted") return VideoAbuseState.ACCEPTED 328 if (v === 'accepted') return VideoAbuseState.ACCEPTED
327 if (v === "pending") return VideoAbuseState.PENDING 329 if (v === 'pending') return VideoAbuseState.PENDING
328 if (v === "rejected") return VideoAbuseState.REJECTED 330 if (v === 'rejected') return VideoAbuseState.REJECTED
329 return undefined 331 return undefined
330 } 332 }
331 }, 333 },
332 is: { 334 is: {
333 prefix: 'is:', 335 prefix: 'is:',
334 handler: v => { 336 handler: v => {
335 if (v === "deleted") return v 337 if (v === 'deleted') return v
336 if (v === "blacklisted") return v 338 if (v === 'blacklisted') return v
337 return undefined 339 return undefined
338 } 340 }
339 }, 341 },