1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
use serde::{Deserialize, Serialize};
use crate::v1::types::{ChannelId, ReportId, UserId};
#[cfg(feature = "utoipa")]
use utoipa::ToSchema;
#[cfg(feature = "validator")]
use validator::Validate;
/// moderation report
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
pub struct Report {
pub id: ReportId,
/// the associated thread id of this report. every report has a thread created for it.
pub thread_id: ChannelId,
/// user id of who reported this
// do i want to make this an Option and allow anonymous reports?
pub reporter_id: UserId,
/// built in reason
pub reason: ReportReason,
/// user supplied note
#[cfg_attr(
feature = "utoipa",
schema(required = false, min_length = 1, max_length = 4096)
)]
pub note: Option<String>,
/// where the report is being sent to
pub destination: ReportDestination,
}
/// who the report is sent to
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
pub enum ReportDestination {
/// send to room moderators
Room,
/// send to server moderators
Server,
}
// these reasons are more or less copied from revolt.chat for now
// (theres quite a lot considering ui design, it looks like they're meant to be nested inside subcategories?)
// i should probably reduce it down to maybe 4 to 8 preset reasons
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
pub enum ReportReason {
/// generally illegal
Illegal,
/// Selling or facilitating use of drugs or other illegal goods
IllegalGoods,
/// Extortion or blackmail
IllegalExtortion,
/// Revenge or child pornography
IllegalPornography,
/// Illegal hacking activity
IllegalHacking,
/// Extreme violence, gore, or animal cruelty With exception to violence portrayed in media / creative arts
ExtremeViolence,
/// Content that promotes harm to others / self
PromotesHarm,
/// Unsolicited advertisements
// seems too similar to SpamAbuse?
UnsolicitedSpam,
/// This is a raid
Raid,
/// user/content: Spam or platform abuse
SpamAbuse,
/// user/content: Scams or fraud
ScamsFraud,
/// Distribution of malware or malicious links
Malware,
/// Harassment or abuse targeted at another user
Harassment,
/// user: profile breaks tos
InappropriateProfile,
/// user: impersonating someone else
Impersonation,
/// user: attempted to evade ban
BanEvasion,
/// user: not old enough
Underage,
/// something else; see note
Other,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "utoipa", derive(ToSchema))]
#[cfg_attr(feature = "validator", derive(Validate))]
pub struct ReportCreate {
/// built in reason
pub reason: ReportReason,
/// user supplied note
// copy url of whatever is reported here
#[cfg_attr(
feature = "utoipa",
schema(required = false, min_length = 1, max_length = 4096)
)]
#[cfg_attr(feature = "validator", validate(length(min = 1, max = 4096)))]
pub note: Option<String>,
// maybe copy thread create params here?
}