aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/abuse/abuse.ts
diff options
context:
space:
mode:
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}