aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/abuse/abuse.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-06 14:58:01 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-07 08:28:14 +0200
commitbd45d503e5d007e730f4e81dccd7e7864c9a85cc (patch)
treeb78df768b8253ba401232c17da940cea016c9960 /server/models/abuse/abuse.ts
parent583eb04b541175035d6d452ca626a96ebf2b7437 (diff)
downloadPeerTube-bd45d503e5d007e730f4e81dccd7e7864c9a85cc.tar.gz
PeerTube-bd45d503e5d007e730f4e81dccd7e7864c9a85cc.tar.zst
PeerTube-bd45d503e5d007e730f4e81dccd7e7864c9a85cc.zip
Reorganize shared models
Diffstat (limited to 'server/models/abuse/abuse.ts')
-rw-r--r--server/models/abuse/abuse.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/models/abuse/abuse.ts b/server/models/abuse/abuse.ts
index 1b599db62..2a407c3d2 100644
--- a/server/models/abuse/abuse.ts
+++ b/server/models/abuse/abuse.ts
@@ -17,11 +17,11 @@ import {
17 UpdatedAt 17 UpdatedAt
18} from 'sequelize-typescript' 18} from 'sequelize-typescript'
19import { isAbuseModerationCommentValid, isAbuseReasonValid, isAbuseStateValid } from '@server/helpers/custom-validators/abuses' 19import { isAbuseModerationCommentValid, isAbuseReasonValid, isAbuseStateValid } from '@server/helpers/custom-validators/abuses'
20import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
20import { 21import {
21 AbuseFilter, 22 AbuseFilter,
22 AbuseObject, 23 AbuseObject,
23 AbusePredefinedReasons, 24 AbusePredefinedReasons,
24 abusePredefinedReasonsMap,
25 AbusePredefinedReasonsString, 25 AbusePredefinedReasonsString,
26 AbuseState, 26 AbuseState,
27 AbuseVideoIs, 27 AbuseVideoIs,
@@ -646,8 +646,10 @@ export class AbuseModel extends Model<AbuseModel> {
646 } 646 }
647 647
648 private static getPredefinedReasonsStrings (predefinedReasons: AbusePredefinedReasons[]): AbusePredefinedReasonsString[] { 648 private static getPredefinedReasonsStrings (predefinedReasons: AbusePredefinedReasons[]): AbusePredefinedReasonsString[] {
649 const invertedPredefinedReasons = invert(abusePredefinedReasonsMap)
650
649 return (predefinedReasons || []) 651 return (predefinedReasons || [])
650 .filter(r => r in AbusePredefinedReasons) 652 .map(r => invertedPredefinedReasons[r] as AbusePredefinedReasonsString)
651 .map(r => invert(abusePredefinedReasonsMap)[r] as AbusePredefinedReasonsString) 653 .filter(v => !!v)
652 } 654 }
653} 655}