aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/models/moderation/abuse
diff options
context:
space:
mode:
Diffstat (limited to 'shared/models/moderation/abuse')
-rw-r--r--shared/models/moderation/abuse/abuse-create.model.ts29
-rw-r--r--shared/models/moderation/abuse/abuse-filter.type.ts1
-rw-r--r--shared/models/moderation/abuse/abuse-reason.model.ts33
-rw-r--r--shared/models/moderation/abuse/abuse-state.model.ts5
-rw-r--r--shared/models/moderation/abuse/abuse-update.model.ts7
-rw-r--r--shared/models/moderation/abuse/abuse-video-is.type.ts1
-rw-r--r--shared/models/moderation/abuse/abuse.model.ts73
-rw-r--r--shared/models/moderation/abuse/index.ts7
8 files changed, 156 insertions, 0 deletions
diff --git a/shared/models/moderation/abuse/abuse-create.model.ts b/shared/models/moderation/abuse/abuse-create.model.ts
new file mode 100644
index 000000000..b0358dbb9
--- /dev/null
+++ b/shared/models/moderation/abuse/abuse-create.model.ts
@@ -0,0 +1,29 @@
1import { AbusePredefinedReasonsString } from './abuse-reason.model'
2
3export interface AbuseCreate {
4 reason: string
5
6 predefinedReasons?: AbusePredefinedReasonsString[]
7
8 account?: {
9 id: number
10 }
11
12 video?: {
13 id: number
14 startAt?: number
15 endAt?: number
16 }
17
18 comment?: {
19 id: number
20 }
21}
22
23// FIXME: deprecated in 2.3. Remove it
24export interface VideoAbuseCreate {
25 reason: string
26 predefinedReasons?: AbusePredefinedReasonsString[]
27 startAt?: number
28 endAt?: number
29}
diff --git a/shared/models/moderation/abuse/abuse-filter.type.ts b/shared/models/moderation/abuse/abuse-filter.type.ts
new file mode 100644
index 000000000..7dafc6d77
--- /dev/null
+++ b/shared/models/moderation/abuse/abuse-filter.type.ts
@@ -0,0 +1 @@
export type AbuseFilter = 'video' | 'comment' | 'account'
diff --git a/shared/models/moderation/abuse/abuse-reason.model.ts b/shared/models/moderation/abuse/abuse-reason.model.ts
new file mode 100644
index 000000000..36875969d
--- /dev/null
+++ b/shared/models/moderation/abuse/abuse-reason.model.ts
@@ -0,0 +1,33 @@
1export enum AbusePredefinedReasons {
2 VIOLENT_OR_REPULSIVE = 1,
3 HATEFUL_OR_ABUSIVE,
4 SPAM_OR_MISLEADING,
5 PRIVACY,
6 RIGHTS,
7 SERVER_RULES,
8 THUMBNAILS,
9 CAPTIONS
10}
11
12export type AbusePredefinedReasonsString =
13 'violentOrRepulsive' |
14 'hatefulOrAbusive' |
15 'spamOrMisleading' |
16 'privacy' |
17 'rights' |
18 'serverRules' |
19 'thumbnails' |
20 'captions'
21
22export const abusePredefinedReasonsMap: {
23 [key in AbusePredefinedReasonsString]: AbusePredefinedReasons
24} = {
25 violentOrRepulsive: AbusePredefinedReasons.VIOLENT_OR_REPULSIVE,
26 hatefulOrAbusive: AbusePredefinedReasons.HATEFUL_OR_ABUSIVE,
27 spamOrMisleading: AbusePredefinedReasons.SPAM_OR_MISLEADING,
28 privacy: AbusePredefinedReasons.PRIVACY,
29 rights: AbusePredefinedReasons.RIGHTS,
30 serverRules: AbusePredefinedReasons.SERVER_RULES,
31 thumbnails: AbusePredefinedReasons.THUMBNAILS,
32 captions: AbusePredefinedReasons.CAPTIONS
33}
diff --git a/shared/models/moderation/abuse/abuse-state.model.ts b/shared/models/moderation/abuse/abuse-state.model.ts
new file mode 100644
index 000000000..b00cccad8
--- /dev/null
+++ b/shared/models/moderation/abuse/abuse-state.model.ts
@@ -0,0 +1,5 @@
1export enum AbuseState {
2 PENDING = 1,
3 REJECTED = 2,
4 ACCEPTED = 3
5}
diff --git a/shared/models/moderation/abuse/abuse-update.model.ts b/shared/models/moderation/abuse/abuse-update.model.ts
new file mode 100644
index 000000000..4360fe7ac
--- /dev/null
+++ b/shared/models/moderation/abuse/abuse-update.model.ts
@@ -0,0 +1,7 @@
1import { AbuseState } from './abuse-state.model'
2
3export interface AbuseUpdate {
4 moderationComment?: string
5
6 state?: AbuseState
7}
diff --git a/shared/models/moderation/abuse/abuse-video-is.type.ts b/shared/models/moderation/abuse/abuse-video-is.type.ts
new file mode 100644
index 000000000..74937f3b9
--- /dev/null
+++ b/shared/models/moderation/abuse/abuse-video-is.type.ts
@@ -0,0 +1 @@
export type AbuseVideoIs = 'deleted' | 'blacklisted'
diff --git a/shared/models/moderation/abuse/abuse.model.ts b/shared/models/moderation/abuse/abuse.model.ts
new file mode 100644
index 000000000..0a0c6bd35
--- /dev/null
+++ b/shared/models/moderation/abuse/abuse.model.ts
@@ -0,0 +1,73 @@
1import { Account } from '../../actors/account.model'
2import { AbuseState } from './abuse-state.model'
3import { AbusePredefinedReasonsString } from './abuse-reason.model'
4import { VideoConstant } from '../../videos/video-constant.model'
5import { VideoChannel } from '../../videos/channel/video-channel.model'
6
7export interface VideoAbuse {
8 id: number
9 name: string
10 uuid: string
11 nsfw: boolean
12
13 deleted: boolean
14 blacklisted: boolean
15
16 startAt: number | null
17 endAt: number | null
18
19 thumbnailPath?: string
20 channel?: VideoChannel
21
22 countReports: number
23 nthReport: number
24}
25
26export interface VideoCommentAbuse {
27 id: number
28 threadId: number
29
30 video: {
31 id: number
32 name: string
33 uuid: string
34 }
35
36 text: string
37
38 deleted: boolean
39}
40
41export interface Abuse {
42 id: number
43
44 reason: string
45 predefinedReasons?: AbusePredefinedReasonsString[]
46
47 reporterAccount: Account
48 flaggedAccount: Account
49
50 state: VideoConstant<AbuseState>
51 moderationComment?: string
52
53 video?: VideoAbuse
54 comment?: VideoCommentAbuse
55
56 createdAt: Date
57 updatedAt: Date
58
59 countReportsForReporter?: number
60 countReportsForReportee?: number
61
62 // FIXME: deprecated in 2.3, remove the following properties
63
64 // @deprecated
65 startAt?: null
66 // @deprecated
67 endAt?: null
68
69 // @deprecated
70 count?: number
71 // @deprecated
72 nth?: number
73}
diff --git a/shared/models/moderation/abuse/index.ts b/shared/models/moderation/abuse/index.ts
new file mode 100644
index 000000000..55046426a
--- /dev/null
+++ b/shared/models/moderation/abuse/index.ts
@@ -0,0 +1,7 @@
1export * from './abuse-create.model'
2export * from './abuse-filter.type'
3export * from './abuse-reason.model'
4export * from './abuse-state.model'
5export * from './abuse-update.model'
6export * from './abuse-video-is.type'
7export * from './abuse.model'